.net Visual Studio项目文件中ProjectTypeGuids标签的意义是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2911565/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 14:19:54  来源:igfitidea点击:

What is the significance of ProjectTypeGuids tag in the visual studio project file

.netvisual-studiovisual-studio-2010projects-and-solutions

提问by sudarsanyes

What is the significance of the ProjectTypeGuids tag in a visual studio project?? When I created a WPF application, i am seeing two GUIDs in here.

ProjectTypeGuids 标签在 Visual Studio 项目中有什么意义?当我创建一个 WPF 应用程序时,我在这里看到两个 GUID。

{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}**

Does these represent WPF and Windows type of applications?

这些是否代表 WPF 和 Windows 类型的应用程序?

If I create my own project type (.myproj) that has .xaml and .cs files, what should I fill in this ProjectTypeGuids tags? Should I also need to fill the ProjectType tag?

如果我创建自己的项目类型 (.myproj),其中包含 .xaml 和 .cs 文件,我应该在这个 ProjectTypeGuids 标签中填写什么?我还需要填写 ProjectType 标签吗?

It would also be better if someone differentiate the ProjectType and ProjectTypeGuids*tags.

如果有人区分 ProjectType 和 ProjectTypeGuids*tags 也会更好。

回答by Julien Hoarau

  • {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}is the GUID for C# project
  • {60dc8134-eba5-43b8-bcc9-bb4bc16c2548}is for project in WPF flavor package
  • {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}是 C# 项目的 GUID
  • {60dc8134-eba5-43b8-bcc9-bb4bc16c2548}用于 WPF 风味包中的项目

So your ProjectTypeGuidsis for a WPF C# project.

所以你ProjectTypeGuids是一个 WPF C# 项目。

You could see the meaning of the different GUID in the register :

您可以在寄存器中看到不同 GUID 的含义:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Projectsfor ProjectTypeGuids
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packagesfor packages reference by some project
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Projects用于 ProjectTypeGuids
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packages一些项目的包参考

Some ProjectTypeGuids

一些 ProjectTypeGuids

Windows (C#)           {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Windows (VB.NET)       {F184B08F-C81C-45F6-A57F-5ABD9991F28F}
Windows (Visual C++)   {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
Web Application        {349C5851-65DF-11DA-9384-00065B846F21}
Web Site               {E24C65DC-7377-472B-9ABA-BC803B73C61A}
WCF                    {3D9AD99F-2412-4246-B90B-4EAA41C64699}
WPF                    {60DC8134-EBA5-43B8-BCC9-BB4BC16C2548}
XNA (Windows)          {6D335F3A-9D43-41b4-9D22-F6F17C4BE596}
XNA (XBox)             {2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2}
XNA (Zune)             {D399B71A-8929-442a-A9AC-8BEC78BB2433}
Silverlight            {A1591282-1198-4647-A2B1-27E5FF5F6F3B}
ASP.NET MVC            {F85E285D-A4E0-4152-9332-AB1D724D3325}
ASP.NET MVC 4          {E3E379DF-F4C6-4180-9B81-6769533ABE47}
Test                   {3AC096D0-A1C2-E12C-1390-A8335801FDAB}
Solution Folder        {2150E333-8FDC-42A3-9474-1A3956D46DE8}      

回答by Athari

From MZ-Tools: List of known project type Guids:

来自MZ-Tools:已知项目类型指南列表

Every Visual Studio project has a project type (Windows project, Smart Device project, Web Site project, etc.) and in some cases more than one type (subtypes or flavors).

每个 Visual Studio 项目都有一个项目类型(Windows 项目、智能设备项目、网站项目等),并且在某些情况下不止一种类型(子类型或风格)。

Every project type is identified by a unique Guid, so every project has one or more project type Guids.

每个项目类型都由一个唯一的 Guid 标识,因此每个项目都有一个或多个项目类型 Guid。

Project type Guids are stored generally in the project file:

项目类型 Guids 一般存储在项目文件中:

<PropertyGroup>
    <ProjectTypeGuids>{A860303F-1F3F-4691-B57E-529FC101A107};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
    ...
</PropertyGroup> 

But for some special projects (such as some database projects) and projects lacking a file (such as Web Site projects), the project type is stored also in the solution file:

但是对于一些特殊的项目(如一些数据库项目)和缺少文件的项目(如网站项目),项目类型也存储在解决方案文件中:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SqlServerProject1", "SqlServerProject1.vbproj", "{BE5F0BE0-93CD-4FCE-A853-9096A442DF1B}"
EndProject

The project type Guids are stored in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version>\Projects. However, not all the Guids stored in that registry key are actual project types. Some of them are used only to provide project templates (for C# and VB.NET projects) and others have other purposes. The following table lists known project type Guids.

项目类型 Guid 存储在注册表项中HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version>\Projects。但是,并非所有存储在该注册表项中的 Guid 都是实际的项目类型。其中一些仅用于提供项目模板(用于 C# 和 VB.NET 项目),而另一些则有其他用途。下表列出了已知的项目类型 Guid。

Project Type Description                 Project Type Guid

Windows (C#)                             {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Windows (VB.NET)                         {F184B08F-C81C-45F6-A57F-5ABD9991F28F}
Windows (Visual C++)                     {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
Web Application                          {349C5851-65DF-11DA-9384-00065B846F21}
Web Site                                 {E24C65DC-7377-472B-9ABA-BC803B73C61A}
Distributed System                       {F135691A-BF7E-435D-8960-F99683D2D49C}
Windows Communication Foundation (WCF)   {3D9AD99F-2412-4246-B90B-4EAA41C64699}
Windows Presentation Foundation (WPF)    {60DC8134-EBA5-43B8-BCC9-BB4BC16C2548}
Visual Database Tools                    {C252FEB5-A946-4202-B1D4-9916A0590387}
Database                                 {A9ACE9BB-CECE-4E62-9AA4-C7E7C5BD2124}
Database (other project types)           {4F174C21-8C12-11D0-8340-0000F80270F8}
Test                                     {3AC096D0-A1C2-E12C-1390-A8335801FDAB}
Legacy (2003) Smart Device (C#)          {20D4826A-C6FA-45DB-90F4-C717570B9F32}
Legacy (2003) Smart Device (VB.NET)      {CB4CE8C6-1BDB-4DC7-A4D3-65A1999772F8}
Smart Device (C#)                        {4D628B5B-2FBC-4AA6-8C16-197242AEB884}
Smart Device (VB.NET)                    {68B1623D-7FB9-47D8-8664-7ECEA3297D4F}
Workflow (C#)                            {14822709-B5A1-4724-98CA-57A101D1B079}
Workflow (VB.NET)                        {D59BE175-2ED0-4C54-BE3D-CDAA9F3214C8}
Deployment Merge Module                  {06A35CCD-C46D-44D5-987B-CF40FF872267}
Deployment Cab                           {3EA9E505-35AC-4774-B492-AD1749C4943A}
Deployment Setup                         {978C614F-708E-4E1A-B201-565925725DBA}
Deployment Smart Device Cab              {AB322303-2255-48EF-A496-5904EB18DA55}
Visual Studio Tools for Apps (VSTA)      {A860303F-1F3F-4691-B57E-529FC101A107}
Visual Studio Tools for Office (VSTO)    {BAA0C2D2-18E2-41B9-852F-F413020CAA33}
SharePoint Workflow                      {F8810EC1-6754-47FC-A15F-DFABD2E3FA90}
XNA (Windows)                            {6D335F3A-9D43-41b4-9D22-F6F17C4BE596}
XNA (XBox)                               {2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2}
XNA (Zune)                               {D399B71A-8929-442a-A9AC-8BEC78BB2433}
SharePoint (VB.NET)                      {EC05E597-79D4-47f3-ADA0-324C4F7C7484}
SharePoint (C#)                          {593B0543-81F6-4436-BA1E-4747859CAAE2}
Silverlight                              {A1591282-1198-4647-A2B1-27E5FF5F6F3B}
ASP.NET MVC 1.0                          {603C0E0B-DB56-11DC-BE95-000D561079B0}
ASP.NET MVC 2.0                          {F85E285D-A4E0-4152-9332-AB1D724D3325}
ASP.NET MVC 3.0                          {E53F8FEA-EAE0-44A6-8774-FFD645390401}
ASP.NET MVC 4.0                          {E3E379DF-F4C6-4180-9B81-6769533ABE47}

回答by sudarsanyes

A thread at msdn has already been started and a lot has been discussed out there. If anybody is interested to know about this, check What is the significance of ProjectTypeGuids tag in the visual studio project file

msdn 上的一个线程已经启动,并且已经讨论了很多。如果有人对此感兴趣,请查看Visual Studio 项目文件中 ProjectTypeGuids 标签的意义是什么

ProjectTypeGuids is used by Visual Studio for project aggregation. In your example you have a WPF (represented by 60dc8134-eba5-43b8-bcc9-bb4bc16c2548) C# project (represented by FAE04EC0-301F-11D3-BF4B-00C04F79EFBC).

If you have a custom project type working with both .xaml and .cs you should try to add your custom project guid (specified by your project factory GUID) as below:

<ProjectTypeGuids>{YourProjectFactoryClassGUID};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} </ProjectTypeGuids>

ProjectTypeGuids 由 Visual Studio 用于项目聚合。在您的示例中,您有一个 WPF(由 60dc8134-eba5-43b8-bcc9-bb4bc16c2548 表示)C# 项目(由 FAE04EC0-301F-11D3-BF4B-00C04F79EFBC 表示)。

如果您有一个同时使用 .xaml 和 .cs 的自定义项目类型,您应该尝试添加您的自定义项目 guid(由您的项目工厂 GUID 指定),如下所示:

<ProjectTypeGuids>{YourProjectFactoryClassGUID};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} </ProjectTypeGuids>