繁体   English   中英

如何正确地将msbuild属性传递给另一个msbuild脚本?

[英]How to pass msbuild properties to another msbuild script correctly?

我有一个master.proj msbuild脚本,它使用MSBuild任务构建多个项目。

这是一个典型的例子:

<Target Name="Log4PostSharp" DependsOnTargets="log4net">
  <MSBuild Projects="Log4PostSharp\Log4PostSharp.sln" Properties="Configuration=$(Configuration)" />
</Target>

但是,我的问题是如果在命令行上给出更多属性,它们不会传递给MSBuild任务。

有没有办法传递MSBuild任务命令行上给出的所有属性?

谢谢。

您必须在Properties属性中将您的额外属性显式传递为以分号分隔的属性名称/值对列表 它不漂亮,但它是要走的路:

<Target Name="Log4PostSharp" DependsOnTargets="log4net">
  <MSBuild Projects="Log4PostSharp\Log4PostSharp.sln" 
           Properties="Configuration=$(Configuration);
                       Platform=$(Platform);
                       OtherPropertyPassInCommandLine=$(PropertyValue)" />
</Target>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM