It turns out there is a property named exactly $ (SolutionName). Try it; first set the environment variable as:
> set MSBuildEmitSolution=1
Then create a solution file using MSBuild from the same command line
> MSBuild My.sln
You will find the conversion of the MSBuild project to a solution file, it will be called My.sln.metaproj .
Just open it in a text editor and you will see other properties. Examine the Create target in this projectd file, you will see that all these properties are passed to the MSBuild task when it is created, so you should be able to distinguish between conditions based on any of them.
source share