开发者

How to pass msbuild properties to another msbuild script correctly?

开发者 https://www.devze.com 2023-01-01 16:59 出处:网络
I have a master.proj msbuild script which builds several project开发者_开发知识库s using the MSBuild task.

I have a master.proj msbuild script which builds several project开发者_开发知识库s using the MSBuild task.

Here is a typical example:

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

But, my problem is that if more properties are given on the command line, they are not passed to the MSBuild task.

Is there a way to pass the MSBuild task all the properties given on the command line?

Thanks.


You have to explicitly pass your extra property as a semicolon-delimited list of property name/value pairs in Properties attribute. It's not pretty but it's the way to go :

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

精彩评论

暂无评论...
验证码 换一张
取 消