给出以下proj片段:
<Project DefaultTargets="artifacts" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<msbuild40>"msbuild.exe"</msbuild40>
</PropertyGroup>
<Target Name="compile">
<Exec Command="$(msbuild40) src\ClientFrameworkLoader.sln /t:Build /p:Configuration=Debug;platform=win32" />
<Exec Command="$(msbuild40) src\ClientFrameworkLoader.sln /t:Build /p:Configuration=Release;platform=win32" />
</Target>
</Project>我是否正确地认为我可以使用以下命令覆盖msbuild40属性?
MSBuild.exe snippet.proj /p:msbuild40="C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe"我现在没有Windows机器,否则我就试试看。
发布于 2015-02-20 13:26:41
是的,你可以这样覆盖财产。但是,您需要在被调用的命令周围放置引号,因为它包含空格。msbuild中的转义引号是$quot;,这也是一种更多的msbuild方法,它不重复自己的操作,并将希望构建的两种配置都放在ItemGroup中并在其上循环。适用这些修改规定:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="artifacts" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<msbuild40>"msbuild.exe"</msbuild40>
</PropertyGroup>
<ItemGroup>
<Configurations Include="Debug;Release"/>
</ItemGroup>
<Target Name="compile">
<Exec Command=""$(msbuild40)" src\ClientFrameworkLoader.sln /t:Build /p:Configuration=%(Configurations.Identity);platform=win32" />
</Target>
</Project>话虽如此,在把它送进野外之前,在windows机器上进行测试也许是明智的:
https://stackoverflow.com/questions/28628454
复制相似问题