I have a (python) script that accomplishes the following:
- Scanning a folder looking for
.csprojand.vcprojfiles. - Creating a solution file to contain all the projects by writing text according to the
.csprojand.vcprojfiles. - Building that solution. By calling
devenv.exe /Buildfrom command line (subprocess.callon python).
My problem is: When I build, VS changes configuration in my SLN. Specifically, on SLN’s Win32 configuration, all the .csproj projects (.NET projects) switch from x86 to x64 and are marked out from the build.
Attempt that did not work:
Changing the SLN to have all the .NETs at x86 and the VCs on Win32 under x86 solution config. Again, VS breaks it when it opens the SLN : VCs are automatically change to target x64 and marked out of the build.
Attempt that worked but quite clumsy:
First, I let VS break the file. The only clumsy way that I managed to do that is calling /Build then /Clean from command line. Next, I fix the SLN file by replacing the configs that VS broke. And now when I /Build it, VS does not alter the SLN.
So:
- Anyone with a more elegant solution ?
- Any nicer way to make VS break the file other then
/Build–/Clean?
The simple answer is, indentation matters to the VS
slnparser.So folks at the company claimed it all worked back in the day, and I found it hard to believe. Over and over again I scanned the code that builds it and the sln file that is produced and couldn’t tell any difference.
Beacuse I didn’t look at whitespaces !
Month ago I innocently changed the code that builds the .sln file to write the file with different indentation.
Here’s the difference of the files:
That worked, because the file was identical to a VS-made file, including the indenetation:
This one caused VS to re-edit, and as a side eefect to break our desired solution configuration: