Visual Studio 解决方案文件中的项目 GUID 有何用途?
我在一个 Visual Studio (2008) 解决方案中有多个项目。
我刚刚发现这些项目中的每一个都使用相同的 GUID,因此在解决方案文件中它看起来像这样:
Project("{FAE04EC0-F103-D311-BF4B-00C04FCBFE97}") = "Pro1", "Pro1\Pro1.csproj", "{...}"
Project("{FAE04EC0-F103-D311-BF4B-00C04FCBFE97}") = "Pro2", "Pro2\Pro2.csproj", "{...}"
我是否必须更改这些 GUID,以便它们是唯一的以及它们的用途是什么?
I have multiple projects in a single Visual Studio (2008) solution.
I just discovered that each of these projects uses a same GUID, so in the solution file it looks like this:
Project("{FAE04EC0-F103-D311-BF4B-00C04FCBFE97}") = "Pro1", "Pro1\Pro1.csproj", "{...}"
Project("{FAE04EC0-F103-D311-BF4B-00C04FCBFE97}") = "Pro2", "Pro2\Pro2.csproj", "{...}"
Do I have to change these GUIDs so they're unique and what are they used for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
解决方案文件中的项目持久性块具有以下格式:
因此,预计第一个 GUID 不是唯一的,它唯一标识处理此类项目的 Visual Studio 包。
您发布的 GUID 很有趣 - 它看起来像损坏的 C# 项目 GUID,即 FAE04EC0-301F-11D3-BF4B-00C04F79EFBC。您自己更改了它还是发布问题(例如您正在使用从右到左的语言环境,例如希伯来语或阿拉伯语)。
Project persistence block in a solution file has the following format:
So it's expected that first GUID is non-unique, it uniquely identifies Visual Studio package that handles this type of projects.
The GUID you posted is interesting - it looks like mangled C# project GUID, which is FAE04EC0-301F-11D3-BF4B-00C04F79EFBC. Did you change it yourself or is it a posting issue (e.g. you are using right-to-left locale such as Hebrew or Arabic).
第一个 GUID 是项目类型。项目类型 GUID 可以在此处找到:
http:// /www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs
从链接:
按描述/项目类型:
按 GUID:
The first GUID is the project type. Project type GUIDs can be found here:
http://www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs
From the link:
By description/project type:
By GUID:
我经常会复制 VS 项目文件,重命名它,然后搜索并替换所有出现的项目名称,以创建具有相同设置的新项目。这通常比创建新项目然后确保所有设置都正确要快。我忽略了 GUID。将项目添加到解决方案后保存项目后,VS 将立即更改 GUID。
我进行了大量的 DLL/C/C++ 开发,多年来我已经广泛偏离了标准项目设置(特别是在优化、代码生成等方面),并且我发现复制技术是一种更快、更可靠的设置方法。项目。
I will often copy a VS project file, rename it and search and replace all occurrences of the project name to create a new project with same settings. This is often quicker than creating a new project and then ensuring all the settings are correct. I ignore the GUID. VS will change the GUID as soon as I save the project after adding it to solution.
I do a lot of DLL/C/C++ development and I have deviated from the standard project settings extensively over the years (particularly in regard to optimization, code generation etc) and I find the copy technique a quicker, surer way of setting up a project.
csproj 文件中的项目 guid 应该是唯一的。根据我的经验,如果同一个解决方案中包含两个 csproj 文件,Visual Studio 会自动重新生成其中一个 guid。
The project guids in the csproj file should be unique. From my experience if two csproj files are included in the same solution visual studio automatically regenerates one of the guids.
忠告:如果制作 XBOX360 XNA 4.0 项目并尝试此技巧,不要使用 VS 2012 生成的 guid。在 VS2010 中生成一个并使用它。
或者,当您尝试在 XNA Game Studio Connect 中运行重新引导的项目时,您将收到以下错误。
然后它就会爆炸。 VS 2010 指南工作正常。我不知道为什么。
Word to the wise: If making an XBOX360 XNA 4.0 project and trying this trick, Don't use a guid generated by VS 2012. generate one in VS2010 and use that.
Or you will get the following error when you try to run your re-guid'ed project in XNA Game Studio Connect.
and then it will bomb. VS 2010 guids work fine. I have no idea why.