[转]List of Visual Studio Project Type GUIDs
本文转自:http://www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs
There isn't an easy way to change the type of a project in Visual Studio project once it is created; for example changing a C# Class Library into a Portable Class Library (PCL). Knowing these GUIDs will allow you to edit project files like .csproj
and .vbproj
to easily change a project type in cases where Visual Studio will not allow using the GUI.
By Description
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} |
C# | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} |
C++ | {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} |
Database | {A9ACE9BB-CECE-4E62-9AA4-C7E7C5BD2124} |
Database (other project types) | {4F174C21-8C12-11D0-8340-0000F80270F8} |
Deployment Cab | {3EA9E505-35AC-4774-B492-AD1749C4943A} |
Deployment Merge Module | {06A35CCD-C46D-44D5-987B-CF40FF872267} |
Deployment Setup | {978C614F-708E-4E1A-B201-565925725DBA} |
Deployment Smart Device Cab | {AB322303-2255-48EF-A496-5904EB18DA55} |
Distributed System | {F135691A-BF7E-435D-8960-F99683D2D49C} |
Dynamics 2012 AX C# in AOT | {BF6F8E12-879D-49E7-ADF0-5503146B24B8} |
F# | {F2A71F9B-5D33-465A-A702-920D77279786} |
J# | {E6FDF86B-F3D1-11D4-8576-0002A516ECE8} |
Legacy (2003) Smart Device (C#) | {20D4826A-C6FA-45DB-90F4-C717570B9F32} |
Legacy (2003) Smart Device (VB.NET) | {CB4CE8C6-1BDB-4DC7-A4D3-65A1999772F8} |
Model-View-Controller v2 (MVC2) | {F85E285D-A4E0-4152-9332-AB1D724D3325} |
Model-View-Controller v3 (MVC3) | {E53F8FEA-EAE0-44A6-8774-FFD645390401} |
Model-View-Controller v4 (MVC4) | {E3E379DF-F4C6-4180-9B81-6769533ABE47} |
Mono for Android | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF} |
MonoTouch | {6BC8ED88-2882-458C-8E55-DFD12B67127B} |
MonoTouch Binding | {F5B4F3BC-B597-4E2B-B552-EF5D8A32436F} |
Portable Class Library | {786C830F-07A1-408B-BD7F-6EE04809D6DB} |
SharePoint (C#) | {593B0543-81F6-4436-BA1E-4747859CAAE2} |
SharePoint (VB.NET) | {EC05E597-79D4-47f3-ADA0-324C4F7C7484} |
SharePoint Workflow | {F8810EC1-6754-47FC-A15F-DFABD2E3FA90} |
Silverlight | {A1591282-1198-4647-A2B1-27E5FF5F6F3B} |
Smart Device (C#) | {4D628B5B-2FBC-4AA6-8C16-197242AEB884} |
Smart Device (VB.NET) | {68B1623D-7FB9-47D8-8664-7ECEA3297D4F} |
Solution Folder | {2150E333-8FDC-42A3-9474-1A3956D46DE8} |
Test | {3AC096D0-A1C2-E12C-1390-A8335801FDAB} |
VB.NET | {F184B08F-C81C-45F6-A57F-5ABD9991F28F} |
Visual Database Tools | {C252FEB5-A946-4202-B1D4-9916A0590387} |
Visual Studio Tools for Applications (VSTA) | {A860303F-1F3F-4691-B57E-529FC101A107} |
Visual Studio Tools for Office (VSTO) | {BAA0C2D2-18E2-41B9-852F-F413020CAA33} |
Web Application | {349C5851-65DF-11DA-9384-00065B846F21} |
Web Site | {E24C65DC-7377-472B-9ABA-BC803B73C61A} |
Windows (C#) | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} |
Windows (VB.NET) | {F184B08F-C81C-45F6-A57F-5ABD9991F28F} |
Windows (Visual C++) | {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} |
Windows Communication Foundation (WCF) | {3D9AD99F-2412-4246-B90B-4EAA41C64699} |
Windows Phone 8/8.1 Blank/Hub/Webview App | {76F1466A-8B6D-4E39-A767-685A06062A39} |
Windows Phone 8/8.1 App (C#) | {C089C8C0-30E0-4E22-80C0-CE093F111A43} |
Windows Phone 8/8.1 App (VB.NET) | {DB03555F-0C8B-43BE-9FF9-57896B3C5E56} |
Windows Presentation Foundation (WPF) | {60DC8134-EBA5-43B8-BCC9-BB4BC16C2548} |
Windows Store (Metro) Apps & Components | {BC8A1FFA-BEE3-4634-8014-F334798102B3} |
Workflow (C#) | {14822709-B5A1-4724-98CA-57A101D1B079} |
Workflow (VB.NET) | {D59BE175-2ED0-4C54-BE3D-CDAA9F3214C8} |
Workflow Foundation | {32F31D43-81CC-4C15-9DE6-3FC5453562B6} |
Xamarin.Android | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF} |
Xamarin.iOS | {6BC8ED88-2882-458C-8E55-DFD12B67127B} |
XNA (Windows) | {6D335F3A-9D43-41b4-9D22-F6F17C4BE596} |
XNA (XBox) | {2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2} |
XNA (Zune) | {D399B71A-8929-442a-A9AC-8BEC78BB2433} |
By GUID
Deployment Merge Module | {06A35CCD-C46D-44D5-987B-CF40FF872267} |
||
Workflow (C#) | {14822709-B5A1-4724-98CA-57A101D1B079} |
||
Legacy (2003) Smart Device (C#) | {20D4826A-C6FA-45DB-90F4-C717570B9F32} |
||
Solution Folder | {2150E333-8FDC-42A3-9474-1A3956D46DE8} |
||
XNA (XBox) | {2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2} |
||
Workflow Foundation | {32F31D43-81CC-4C15-9DE6-3FC5453562B6} |
||
Web Application | {349C5851-65DF-11DA-9384-00065B846F21} |
||
Test | {3AC096D0-A1C2-E12C-1390-A8335801FDAB} |
||
Windows Communication Foundation (WCF) | {3D9AD99F-2412-4246-B90B-4EAA41C64699} |
||
Deployment Cab | {3EA9E505-35AC-4774-B492-AD1749C4943A} |
||
Smart Device (C#) | {4D628B5B-2FBC-4AA6-8C16-197242AEB884} |
||
Database (other project types) | {4F174C21-8C12-11D0-8340-0000F80270F8} |
||
SharePoint (C#) | {593B0543-81F6-4436-BA1E-4747859CAAE2} |
||
ASP.NET MVC 1.0 | {603C0E0B-DB56-11DC-BE95-000D561079B0} |
||
Windows Presentation Foundation (WPF) | {60DC8134-EBA5-43B8-BCC9-BB4BC16C2548} |
||
Smart Device (VB.NET) | {68B1623D-7FB9-47D8-8664-7ECEA3297D4F} |
||
MonoTouch | {6BC8ED88-2882-458C-8E55-DFD12B67127B} |
||
XNA (Windows) | {6D335F3A-9D43-41b4-9D22-F6F17C4BE596} |
||
Windows Phone 8/8.1 Blank/Hub/Webview App | {76F1466A-8B6D-4E39-A767-685A06062A39} |
||
Portable Class Library | {786C830F-07A1-408B-BD7F-6EE04809D6DB} |
||
C++ | {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} |
||
Deployment Setup | {978C614F-708E-4E1A-B201-565925725DBA} |
||
Silverlight | {A1591282-1198-4647-A2B1-27E5FF5F6F3B} |
||
Visual Studio Tools for Applications (VSTA) | {A860303F-1F3F-4691-B57E-529FC101A107} |
||
Database | {A9ACE9BB-CECE-4E62-9AA4-C7E7C5BD2124} |
||
Deployment Smart Device Cab | {AB322303-2255-48EF-A496-5904EB18DA55} |
||
Visual Studio Tools for Office (VSTO) | {BAA0C2D2-18E2-41B9-852F-F413020CAA33} |
||
Windows Store Apps (Metro Apps) | {BC8A1FFA-BEE3-4634-8014-F334798102B3} |
||
C# in Dynamics 2012 AX AOT | {BF6F8E12-879D-49E7-ADF0-5503146B24B8} |
||
Windows Phone 8/8.1 App (C#) |
|
||
Visual Database Tools | {C252FEB5-A946-4202-B1D4-9916A0590387} |
||
Legacy (2003) Smart Device (VB.NET) | {CB4CE8C6-1BDB-4DC7-A4D3-65A1999772F8} |
||
XNA (Zune) | {D399B71A-8929-442a-A9AC-8BEC78BB2433} |
||
Workflow (VB.NET) | {D59BE175-2ED0-4C54-BE3D-CDAA9F3214C8} |
||
Windows Phone 8/8.1 App (VB.NET) |
|
||
Web Site | {E24C65DC-7377-472B-9ABA-BC803B73C61A} |
||
ASP.NET MVC 4.0 | {E3E379DF-F4C6-4180-9B81-6769533ABE47} |
||
ASP.NET MVC 3.0 | {E53F8FEA-EAE0-44A6-8774-FFD645390401} |
||
J# | {E6FDF86B-F3D1-11D4-8576-0002A516ECE8} |
||
SharePoint (VB.NET) | {EC05E597-79D4-47f3-ADA0-324C4F7C7484} |
||
Xamarin.Android / Mono for Android | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF} |
||
Distributed System | {F135691A-BF7E-435D-8960-F99683D2D49C} |
||
VB.NET | {F184B08F-C81C-45F6-A57F-5ABD9991F28F} |
||
F# | {F2A71F9B-5D33-465A-A702-920D77279786} |
||
MonoTouch Binding | {F5B4F3BC-B597-4E2B-B552-EF5D8A32436F} |
||
ASP.NET MVC 2.0 | {F85E285D-A4E0-4152-9332-AB1D724D3325} |
||
SharePoint Workflow | {F8810EC1-6754-47FC-A15F-DFABD2E3FA90} |
||
C# | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} |
Notes
- You will find these proeprties as a
<ProjectTypeGuids>
element in the project file, not to be confused with<ProjectGuid>
which is a unique identifier for your project. - Some GUIDs are used in combination. For example
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
describes aXamarin.Android library in C#.
http://www.cnblogs.com/guanglin/archive/2013/04/07/2948385.html
进来由于需要分析VS的工程结构,大家都知道以.sln结尾的就是vs的解决方案文件
废话不多说,首先查看下一个简单的sln文件结构
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{CD680A35-B1DB-4A3D-9073-2A604600D396}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD680A35-B1DB-4A3D-9073-2A604600D396}.Debug|x86.ActiveCfg = Debug|x86
{CD680A35-B1DB-4A3D-9073-2A604600D396}.Debug|x86.Build.0 = Debug|x86
{CD680A35-B1DB-4A3D-9073-2A604600D396}.Release|x86.ActiveCfg = Release|x86
{CD680A35-B1DB-4A3D-9073-2A604600D396}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
其中第一行是文件说明,里面有一句Format Version 11.00 这句说明的就是解决方案的vs版本
其中以Project开头的就是解决方案所包含的工程,另外还有已Global开头EndGlobal结尾的片段,这里有解决方案的一些全局配置,里面内容一看就明白,这里就不多说了。重点看Project片段,此例中只包含一个Project,大家有没有发现Project后面跟了一个GUID,这个是什么呢?
进过查资料发现,这里的GUID代表着工程类型,例如上面的"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"代表的是一个C#的工程,后面是工程名以及工程文件路径
下面附上GUID代表的工程类型表
Visual Studio 所使用的 *.sln,*.csproj,*.vbproj 等文件表示项目类型的 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 Applications (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 Application | {603C0E0B-DB56-11DC-BE95-000D561079B0} |
其中有一个GUID不在列表中大家也有可能会经常遇到,那就是解决方案文件夹,它的类型ID为"2150E333-8FDC-42A3-9474-1A3956D46DE8"
如何获取解决方案的内容呢?
这里我使用的正则表达式,下面为GUID,命名规则,相对路径的表达式
public class RegexExpressionConst { /// <summary> /// GUID的正则表达式,格式 FAE04EC0-301F-11D3-BF4B-00C04F79EFBC /// </summary> public const string GuidExp = @"\w{8}-(\w{4}-){3}\w{12}"; /// <summary> /// 匹配[工程文件命名] /// </summary> public const string ProjectExt = @"[a-z][\s\.\-\w]+"; /// <summary> /// 匹配[相对路径] /// </summary> public const string RelativePathExt = @"(\\?([a-z][\s\.\-\w]+))+"; }
下面就是组合这些表达式,以下就是组合后的正则表达式用于匹配sln中的工程
var projectRegexExp = string.Format("Project\\(\"{{{0}}}\"\\)\\s*=\\s*\"{1}\"\\s*,\\s*\"{2}\"\\s*,\\s*\"{{{3}}}\"", RegexExpressionConst.GuidExp, RegexExpressionConst.ProjectExt, RegexExpressionConst.RelativePathExt, RegexExpressionConst.GuidExp);
获取其中的工程文件的名称,工程文件路径,工程文件的类型,这里还定义了一个新的实体方便存储操作
var projectPropertyModels = new List<ProjectPropertyModel>(); var projectReg = new Regex(projectRegexExp, RegexOptions.Compiled | RegexOptions.IgnoreCase); var projectContexts = projectReg.Matches(fileContent); foreach (var projectContext in projectContexts) { var projectPropertyModel = new ProjectPropertyModel(); var projectContextArr = projectContext.ToString().Split(new string[]{"="}, StringSplitOptions.RemoveEmptyEntries); projectPropertyModel.ProjectTypeID = new Regex(RegexExpressionConst.GuidExp).Match(projectContextArr[0]).ToString().Trim(); var projectValueArr = projectContextArr[1].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); projectPropertyModel.ProjectName = projectValueArr[0].Replace("\"", "").Trim(); projectPropertyModel.ProjectRelativePath = projectValueArr[1].Replace("\"", "").Trim(); projectPropertyModel.ProjectID = projectValueArr[2].Replace("\"{", "").Replace("}\"", "").Trim(); projectPropertyModel.ProjectAbsolutePath = Path.Combine(slnFolderPath, projectPropertyModel.ProjectRelativePath); projectPropertyModels.Add(projectPropertyModel); } /// <summary> /// 工程文件属性 /// </summary> public class ProjectPropertyModel { /// <summary> /// 工程类型ID /// </summary> public string ProjectTypeID { get; set; } /// <summary> /// 工程名称 /// </summary> public string ProjectName { get; set; } /// <summary> /// 工程相对路径 /// </summary> public string ProjectRelativePath { get; set; } /// <summary> /// 工程绝对路径 /// </summary> public string ProjectAbsolutePath { get; set; } /// <summary> /// 工程唯一标识 /// </summary> public string ProjectID { get; set; } }
有了工程文件的名称,工程文件路径,工程文件的类型,下面就让我们解析工程文件吧
工程文件大家打开自己电脑上的以*.csproj这个结尾的文件看看吧,这里就不贴了,太长了
说道解析工程文件解析这里就不得不提Microsoft.Build.Evaluation.ProjectCollection,这个集合可以直接加载一个工程到集合中,并返回一个Project
ProjectCollection pc = new ProjectCollection(); Project _Project = pc.LoadProject(projectFilePath)
这里我们就可以很简单的获取工程文件中的内容了
程序集文件夹
_Project.DirectoryPath
获取程序集名称 _Project.GetPropertyValue("AssemblyName"); 获取编译后文件夹 _Project.GetPropertyValue("TargetDir"); 获取编译后路径 _Project.GetPropertyValue("TargetPath"); 获取所有引用项 _Project.AllEvaluatedItems.Where(e => e.ItemType == "Reference") 获取所有编译项 _Project.AllEvaluatedItems.Where(e => e.ItemType == "Compile") 获取所有页面 _Project.AllEvaluatedItems.Where(e => e.ItemType == "Page") 获取其他项 _Project.AllEvaluatedItems.Where(e => e.ItemType == "None")
这里列出来一些常用项,更详细的大家可以直接查看http://technet.microsoft.com/zh-cn/microsoft.build.evaluation.project(v=vs.90)
呵呵,有了这些东西我们的整个工程结构是不是都有了呢,下面就可以干我们想干的事情了。
posted on 2015-04-10 13:59 freeliver54 阅读(886) 评论(0) 编辑 收藏 举报