Mtn*_*sty 5 c# msbuild makefile cakebuild
我有一个批处理文件,我试图用Cake(C#Make)复制.它使用一些属性调用MSBuild.这是批次中的行;
"%MSBuildPath%msbuild.exe" ..\public\projectToBeBuilt.sln /t:Rebuild /p:Configuration=RELEASE;platform=%platform% /maxcpucount:%cpucount% /v:%verboselevel%
Run Code Online (Sandbox Code Playgroud)
这些是我需要设置的属性.我觉得它是这样的;
MSBuild(@"..\public\projectToBeBuilt.sln", s=> s.SetConfiguration("Release")
.UseToolVersion(MSBuildToolVersion.Default)
.WithProperty("Verbosity", Verbosity)
.WithProperty("MaxCpuCount", cpuCount)
.WithProperty("Platform", "x64")
.WithProperty("OutDir", buildDir));
Run Code Online (Sandbox Code Playgroud)
我无法完成这项工作.我想这可能与我如何指定cpu计数有关.我也无法找到任何方法将其设置为Rebuild,就像批处理一样.
dev*_*ead 10
你得到什么样的错误?
要像在批处理示例中那样进行重建,您可以像这样使用WithTarget设置目标
.WithTarget("Rebuild")
Run Code Online (Sandbox Code Playgroud)
关于CPU数量,如果我这样设置,我没有问题
.SetMaxCpuCount(System.Environment.ProcessorCount)
Run Code Online (Sandbox Code Playgroud)
设置平台看起来像这样
.SetPlatformTarget(PlatformTarget.x64)
Run Code Online (Sandbox Code Playgroud)
设置详细程度将是
.SetVerbosity(Verbosity)
Run Code Online (Sandbox Code Playgroud)
所以一个完整的命令可能看起来像
MSBuild(solution, settings =>
settings.SetConfiguration("Release")
.UseToolVersion(MSBuildToolVersion.Default)
.WithTarget("Rebuild")
.SetMaxCpuCount(cpuCount)
.SetPlatformTarget(PlatformTarget.x64)
.SetVerbosity(Verbosity)
.WithProperty("OutDir", buildDir)
);
Run Code Online (Sandbox Code Playgroud)
这里记录了MSBuild设置的流畅API方法.
| 归档时间: |
|
| 查看次数: |
3654 次 |
| 最近记录: |