开发者

"Finally" target for MSBuild

开发者 https://www.devze.com 2022-12-27 00:02 出处:网络
Is there a way to run a certain target after all oth开发者_开发百科er targets have been run regardless of their success or failure?

Is there a way to run a certain target after all oth开发者_开发百科er targets have been run regardless of their success or failure?

try...finally equivalent in MsBuild is related, but only deals with a small group of targets. I need something for the whole package with dozens of sub builds.


Maybe if you wrapped things in a top-level target using one or more CallTargets, then you could use an <OnError .../> task to run a final target?

<Target Name="CompleteBuild">
  <CallTarget Targets="Target1"/>
  <CallTarget Targets="Target2"/>
  <CallTarget Targets="FinalTarget"/>

  <OnError ExecuteTargets="FinalTarget"/>
</Target>


There is no straight forward way of doing this. Usually in MSBuild it is hard to know the actual order of targets, only the relative order. What are you trying to do with this target?

0

精彩评论

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