我通过修改 .csproj 文件以包含一个额外的编译符号,从我的 .sln 生成两组不同的 DLL 文件。我正在使用 rake 构建解决方案,并执行以下构建任务:
#==========================================================
desc "Builds the DPSF.sln in Release mode."
msbuild :Build do |msb|
puts 'Building the DPSF solution...'
msb.properties :configuration => :Release
msb.targets [:Clean, :Rebuild]
msb.solution = DPSF_SOLUTION_FILE_PATH
msb.parameters "/nologo", "/maxcpucount", "/fileLogger", "/noconsolelogger"
msb.verbosity = "quiet" # Use "diagnostic" instead of "quiet" for troubleshooting build problems.
# Delete the build log file if the build was successful (otherwise the script will puke before this point).
File.delete('msbuild.log')
end
然后我尝试使用以下方法生成两组 DLL 文件:
desc "Builds new regular and AsDrawableGameComponent DLLs."
task :BuildNewDLLs => [:DeleteExistingDLLs, :Build, :UpdateCsprojFilesToBuildAsDrawableGameComponentDLLs, :Build, :RevertCsprojFilesToBuildRegularDLLs]
你可以看到我在这里调用了两次 :Build 。问题是只有第一个运行。如果我复制/粘贴我的 :Build 目标并将其称为 :Build2 并将 :BuildNewDLLs 更改为第二次调用 :Build2,那么一切正常。那么我怎样才能做到这一点,以便我可以从 :BuildNewDLLs 目标中多次调用 :Build 目标?
提前致谢。
最佳答案
我知道这是一个老问题,但我只花了 15 分钟来解决这个问题,所以为了文档起见,这里是:
您可以在您希望重新启用的同一任务中调用reenable
。由于 task
block 将当前任务作为第一个参数,您可以:
task :thing do |t|
puts "hello"
t.reenable
end
现在可以了:
rake thing thing
关于ruby - 如何调用 rake 目标两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10391834/