简体   繁体   中英

MSBuild BuildDependsOn target for release builds only?

I would like to add a build target to the BuildDependsOn, but I want it to only affect release builds. How do I do this in MSBuild?

Add a condition when you override the BuildDependsOn property :

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
...
<BuildDependsOn Condition="'$(Configuration)' == 'Release'">
  BeforeBuild;
  CoreBuild;
  AfterBuild;
  NewBuildTarget;
</BuildDependsOn>

I think you can just add

Condition="'$(Configuration)'=='Release'"

to the <Target> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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