msbuild script utilizing solution information

后端 未结 1 1824
梦毁少年i
梦毁少年i 2021-01-06 09:35

I have a csproj file, being part of two different Visual Studio solutions. The project file should be able to behave slightly different, depending on the solution it will be

相关标签:
1条回答
  • 2021-01-06 10:14

    Turns out there is a property named exactly $(SolutionName). Try this; first set an environment variable as:

    > set MSBuildEmitSolution=1
    

    Then build your solution file using MSBuild from the same command line

    > MSBuild My.sln
    

    You will find the MSBuild project transformation of your solution file, it will be named My.sln.metaproj.

    Just open that in a text editor and you can see the other properties. Examine the "Build" target in this projectd file, you can see that all these properties are passed in to the MSBuild task when it builds your projects, so you should be able to discriminate conditions based on any of them.

    0 讨论(0)
提交回复
热议问题