Project GUID keeps changing

22,015

Solution 1

I also see this problem in Visual Studio 2013, and it does not require Source Control integration to occur.

It happens to me occasionally when I have the same project in multiple solutions, each solution uses a different GUID for that project, and updates the project accordingly. The solution is to manually modify the .sln files to get them in sync. Credit for this answer goes to Chunsheng Tang.

First open the solution file (.sln) with notepad and check out the project references there. The format is like this:

     # Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsApplication1", "WindowsApplication1\WindowsApplication1.csproj", "{9378D255-CE38-45CD-82FA-A1EBFB86FD6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{DE374096-FF44-4FDF-B248-C767039B4175}"
EndProject

The second GUID for each project is the reference to the shared project.

To solve the problem, select a single GUID for your shared project; Make sure all the solutions that open it have that single thus the same GUID in their solution files. (Please backup your files before making these changes)

https://social.msdn.microsoft.com/Forums/en-US/1d632940-cc1d-49d5-a64c-d3e999216cbd/cant-avoid-the-projectguid-from-being-changed-in-csproj-file?forum=csharpide

Solution 2

The ProjectGuid changes because of integration with a source control system, like TFS. Happens if other people open the files for example.

There is workaround described here:

http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/1d632940-cc1d-49d5-a64c-d3e999216cbd

Solution 3

The problem for me turned out to be a duplicate GUID in one of the solution files. Inside the .sln for my installer I found that the Config project GUID (used all over the place) and the Installer project GUID (specific to the solution) were identitical. Opening the solution caused VS to change the GUID for one of them in the project file, though not apparently in the solution file. As it happens it always chose the shared one causing maximum grief. The fix was to create a new GUID for the installer project, and manually edit all the other solution files back to the correct GUID for the Config project.

I've no idea how this came about since I don't ever copy projects to create them.

Share:
22,015
lysergic-acid
Author by

lysergic-acid

Software Engineer, Game Developer, Cat Owner Blogging @ http://www.tallior.com Check out my gigs @ http://www.fiverr.com/lysergide

Updated on February 01, 2020

Comments

  • lysergic-acid
    lysergic-acid over 4 years

    We have a VS2008 solution and i've noticed something weird happening:

    some projects refer other projects that are defined in the same solution (added as project references). This was done some time ago.

    Building straight from VS works fine.

    Building from MSBUILD fails.

    I have removed the project reference and re added it, and i've noticed that the project's GUID is changed. Building from MSBUILD now works.

    Problem is, i now have to go over all projects and verify this.

    Moreover, i have no idea why this occured (why is the project GUID different from what it was before, and not sure if this may happen again).

    What could be the cause of this?