Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project GUID keeps changing

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?

like image 533
lysergic-acid Avatar asked Sep 11 '11 09:09

lysergic-acid


People also ask

What is ProjectGuid?

ProjectGuid is a unique identifier of a project within a solution. In SDK-based projects, the solution is the only thing that is aware of the project GUID - there was no need to duplicate it in the project.

How do I change the location of a SLN file?

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.

How can you tell if a project is asp net?

If you want to know if it's a WCF Project or ASP.NET Web Service simply open your project's folders in File Explorer. You can hover over the icon with your mouse and a tooltip will display the project type as shown in the picture. Also, you can look under the Type column in File Explorer and it shows it there as well.


2 Answers

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

like image 102
Ty H. Avatar answered Oct 07 '22 17:10

Ty H.


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

like image 28
Bogdan Gavril MSFT Avatar answered Oct 07 '22 18:10

Bogdan Gavril MSFT