How to invoke the same msbuild target twice?

不打扰是莪最后的温柔 提交于 2019-12-01 03:38:34

By design MSBuild targets are not executed more than once. You should not think of an MSBuild target as a method or function, bucause MSBuild is not a functional programming language.

If you want to execute a target more than once you can use the MSBuild task to do so, just pass in a different set of properties. For example something like this

<Target Name="SomeTarget">
    <MSBuild Projects="$(MSBuildProjectFile)" Targets="YourTarget" Properties="FakeProperty=one" />
    <MSBuild Projects="$(MSBuildProjectFile)" Targets="YourTarget" Properties="FakeProperty=two" />
</Target>

Note: I didn't actually try this out so there might be syntax issues if I mis-spelled or remembered incorrectly but you should be able to get it working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!