16

I know that I can pass MSBuild a VS solution file (.sln) and it will build the solution but somewhere in the back of my mind, I remember using a MSBuild command line switch that would take a solution file (and it's referenced project files) and generate a single MSBuild project file from them. However, I now can't find this switch! Was this all a dream?

I see the /preprocess switch (short form /pp) but I don't think that this was it as this will include all of the imported files (including Microsoft.*.targets) and besides I can't seem to get this switch to work. I when I try the following command line, MSbuild generates the *.out file but its empty!

msbuild /target:rebuild /generate MSBuildCopyTargets.sln
Mrchief
  • 75,126
  • 20
  • 142
  • 189
PMBottas
  • 611
  • 6
  • 10

1 Answers1

22

The easiest way to do this is to run MSBuild from the command line, with an environment variable set:

  Set MSBuildEmitSolution=1

The output will be in the format SolutionName.metaproj

Ritch Melton
  • 11,498
  • 4
  • 41
  • 54