开发者

Visual Studio 2010 don't execute msbuild task for solutions in build events. How to fix this?

开发者 https://www.devze.com 2023-03-19 01:23 出处:网络
I have one of projects of my solution dependent on another solution: code that will not be changed frequently. To exclude this code from primary solution, I\'ve referenced resulting il-merged dll, and

I have one of projects of my solution dependent on another solution: code that will not be changed frequently. To exclude this code from primary solution, I've referenced resulting il-merged dll, and added next code to the proj开发者_如何学Pythonect file:

<Target Name="BeforeBuild">
    <MsBuild Projects="$(PathToAnotherSolutionFile)" Properties="Configuration=$(Configuration)" Condition="!Exists($(AnotherSolutionDll))"/>
</Target>

As a result, external solution is built only once on fresh checkout. That's desired behavior, and it works as expected if launched from command line. But if to build solution from Visual Studio, MsBuild task is not executed for some reason.

However, it is executed, if to put single project instead of solution in "Projects".

Is there meaningful explanation to this behavior, and is there way to workaround it?


Ok, here is workaround:

<Target Name="BeforeBuild">
    <Exec Command="$(MSBuildBinPath)\msbuild $(PathToAnotherSolutionFile) /p:Configuration=$(Configuration)" Condition="!Exists($(AnotherSolutionDll))"/>
</Target>

It's stupid, but it works. But the question why don't it work is still open.

0

精彩评论

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

关注公众号