I work in a team on a Visual C++ project. Following advice we got we're tracking the project's .sln file with our SCM. It turns out that each time I pull from my partner (yes, we use git) and open the solution in VS, the .sln file is updated. The part being updated is the long id that appears several times (in this case ending with 7C44) in the following segment:
{828CB89E-F092-3B7A-2F8C-62E146587C44}.Debug|Win32.ActiveCfg = Debug|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.Debug|Win32.Build.0 = Debug|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.DebugStaticCRT|Win32.ActiveCfg = DebugStaticCRT|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.DebugStaticCRT|Win32.Build.0 = DebugStaticCRT|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.Release|Win32.ActiveCfg = Release|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.Release|Win32.Build.0 = Release|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.ReleaseStaticCRT|Win32.ActiveCfg = ReleaseStaticCRT|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.ReleaseStaticCRT|Win32.Build.0 = ReleaseStaticCRT|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.Template|Win32.ActiveCfg = Template|Win32
{828CB89E-F092-3B7A-2F8C-62E146587C44}.Template|Win32.Build.0 = Template|Win32
What does this number mean? How can we make it stop changing between us?
If the sln is under source control first go to File | Source Control | Advanced | Change Source Control. Select the solution and click "Unbind". After saving the . sln to the new folder you can bind it again to source control.
sln is a text file that groups together multiple project files. *. vcxproj is Visual Studio 2010 and above.
Visual Studio 2022 : Double Clicking on solution file in the Source Control Explorer opens the sln file as plain text - Visual Studio Feedback.
I had a difficult time finding this particular post when searching for the answer, so I just wanted to add some key words and explanation to make it easier to find. Thanks to the fantastic answers by Daniel and tgb I was able to resolve this issue and my team and I no longer have conflicting solution files after opening Visual Studio 2010 (I would vote their answers up, but I just joined today and do not yet have enough reputation points to vote answers up...).
So, to ask the question in a few more ways: Why does Visual Studio change .sln files when opening a solution? Why do .sln files have local modifications? or What causes merge conflicts in Visual Studio Solution files?
Answer: Most likely a different or missing ProjectGuid attribute in the .vcxproj Project file will cause local modifications. This could be due to upgrading projects from previous versions of Visual Studio or just from manually copying a project file and editing parts of it.
The fix is to add the line:
<ProjectGuid>{###}</ProjectGuid>
(with the appropriate ID from the solution file in place of ###) to the .vcxproj file in the 'PropertyGroup Label="Globals"' node, for example:
<PropertyGroup Label="Globals">
<ProjectGuid>{FD0675C0-EC06-E665-4001-12DEE6694605}</ProjectGuid>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
Otherwise Visual Studio will just assign a new random ProjectGuid to each project and update the .sln file. The 'ProjectGuid' can easily be found for a given project in the .sln file:
Project("{<Filter#>}") = "MyProjName", "src\to\Proj.vcxproj", "{<ProjectGuid>}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With