项目GUID不断变化 [英] Project GUID keeps changing

查看:94
本文介绍了项目GUID不断变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个VS2008解决方案,我注意到发生了一些奇怪的事情:

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.

直接从VS构建就可以了.

Building straight from VS works fine.

从MSBUILD构建失败.

Building from MSBUILD fails.

我已经删除了项目引用并重新添加了它,并且我注意到项目的GUID已更改.现在可以从MSBUILD进行构建.

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.

此外,我不知道为什么会这样(为什么项目GUID与以前不同,并且不确定是否会再次发生).

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).

这可能是什么原因?

推荐答案

我还在Visual Studio 2013中看到此问题,并且不需要进行源代码管理集成.

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

当我在多个解决方案中拥有同一个项目时,偶尔会发生这种情况,每个解决方案对该项目使用不同的GUID,并相应地更新该项目.解决方案是手动修改.sln文件以使其同步.此答案归功于Chunsheng Tang.

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.

首先使用记事本打开解决方案文件(.sln),然后在其中签出项目引用.格式如下:

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

每个项目的第二个GUID是对共享项目的引用.

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

要解决此问题,请为您的共享项目选择一个GUID.确保打开它的所有解决方案在其解决方案文件中都具有单个GUID,因此具有相同的GUID. (请先备份文件,然后再进行这些更改)

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)

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆