# [ACCEPTED]-Visual Studio keeps changing project.sln file-projects-and-solutions

Score: 33

I had a difficult time finding this particular 26 post when searching for the answer, so I 25 just wanted to add some key words and explanation 24 to make it easier to find. Thanks to the 23 fantastic answers by Daniel and tgb I was 22 able to resolve this issue and my team and 21 I no longer have conflicting solution files 20 after opening Visual Studio 2010 (I would 19 vote their answers up, but I just joined 18 today and do not yet have enough reputation 17 points to vote answers up...).

So, to ask 16 the question in a few more ways: Why does Visual Studio change .sln files when opening 15 a solution? Why do .sln files have local modifications? or What causes merge conflicts in Visual Studio Solution files?

Answer: Most likely a different 14 or missing ProjectGuid attribute in the 13 .vcxproj Project file will cause local modifications. This 12 could be due to upgrading projects from 11 previous versions of Visual Studio or just 10 from manually copying a project file and 9 editing parts of it.

The fix is to add the 8 line:

<ProjectGuid>{###}</ProjectGuid>


(with the appropriate ID from the solution 7 file in place of ###) to the .vcxproj file 6 in the 'PropertyGroup Label="Globals"' node, for 5 example:

  <PropertyGroup Label="Globals">
<ProjectGuid>{FD0675C0-EC06-E665-4001-12DEE6694605}</ProjectGuid>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>


Otherwise Visual Studio will just 4 assign a new random ProjectGuid to each 3 project and update the .sln file. The 'ProjectGuid' can 2 easily be found for a given project in the 1 .sln file:

Project("{<Filter#>}") = "MyProjName", "src\to\Proj.vcxproj", "{<ProjectGuid>}"

Score: 11

That is a GUID which Visual Studio uses 9 to refer to the individual projects. You 8 will find the same GUID at the top of the 7 .sln file, where the projects are defined/imported.

Visual 6 Studio reads the GUID from the corresponding 5 .csproj/.vbproj file. There you should find 4 a ProjectGuid property near the top with 3 the corresponding GUID. If you and your 2 partner have a different GUID defined there, the 1 .sln will also update.

Score: 7

I've had the same problem. I finally noticed 3 it came from a vcxproj file which didn't 2 define its GUID. I manually added this GUID 1 in my vcxproj file :

  <PropertyGroup Label="Globals">