SLN 文件中的 GUID

发布于 2024-07-05 18:14:30 字数 99 浏览 6 评论 0原文

Visual Studio 解决方案文件的每个项目条目包含两个 GUID。 我想其中之一来自 AssemblyInfo.cs

有谁知道它们来自哪里以及它们的用途吗?

Visual Studio Solution files contain two GUID's per project entry. I figure one of them is from the AssemblyInfo.cs

Does anyone know for sure where these come from, and what they are used for?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慕巷 2024-07-12 18:14:30

根据 MSDN

[Project] 语句包含
唯一的项目 GUID 和项目
键入 GUID。 该信息用于
寻找项目的环境
文件或属于
解决方案,以及所需的 VSPackage
对于每个项目。 项目 GUID 是
传递给 IVsProjectFactory 进行加载
与特定 VSPackage 相关
项目,然后该项目被加载
VSPackage。

According to MSDN:

[The Project] statement contains the
unique project GUID and the project
type GUID. This information is used by
the environment to find the project
file or files belonging to the
solution, and the VSPackage required
for each project. The project GUID is
passed to IVsProjectFactory to load
the specific VSPackage related to the
project, then the project is loaded by
the VSPackage.

神经大条 2024-07-12 18:14:30

这两个 GUID 都与 AssemblyInfo.cs 中的 GUID 不同(即程序集本身的 GUID,不与 Visual Studio 绑定,而是与构建的最终产品绑定)。

因此,对于 sln 文件中的典型行(如果您希望看到它,请在记事本或选择的编辑器中打开 .sln):

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleSandbox", "ConsoleSandbox\ConsoleSandbox.csproj", "{55A1FD06-FB00-4F8A-9153-C432357F5CAC}"

第二个 GUID 是项目本身的唯一 GUID。 解决方案文件使用它来将其他设置映射到该项目:

GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

第一个 GUID 实际上是一个 GUID,它是解决方案本身的唯一 GUID(我相信)。 如果您的解决方案包含多个项目,您实际上会看到类似以下内容的内容:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleSandbox", "ConsoleSandbox\ConsoleSandbox.csproj", "{55A1FD06-FB00-4F8A-9153-C432357F5CAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Composite", "..\CompositeWPF\Source\CAL\Composite\Composite.csproj", "{77138947-1D13-4E22-AEE0-5D0DD046CA34}"
EndProject

Neither GUID is the same GUID as from AssemblyInfo.cs (that is the GUID for the assembly itself, not tied to Visual Studio but the end product of the build).

So, for a typical line in the sln file (open the .sln in notepad or editor-of-choice if you wish to see this):

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleSandbox", "ConsoleSandbox\ConsoleSandbox.csproj", "{55A1FD06-FB00-4F8A-9153-C432357F5CAC}"

The second GUID is a unique GUID for the project itself. The solution file uses this to map other settings to that project:

GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {55A1FD06-FB00-4F8A-9153-C432357F5CAC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

The first GUID is actually a GUID that is the unique GUID for the solution itself (I believe). If you have a solution with more than one project, you'll actually see something like the following:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleSandbox", "ConsoleSandbox\ConsoleSandbox.csproj", "{55A1FD06-FB00-4F8A-9153-C432357F5CAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Composite", "..\CompositeWPF\Source\CAL\Composite\Composite.csproj", "{77138947-1D13-4E22-AEE0-5D0DD046CA34}"
EndProject
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文