How does visualstudio know about the type of current project?

In Visual Studio, the context menu command for adding an item to a WinForms project is different from what is shown for a WPF project. In fact, I see "Add-> Windows Form" in the first and "Add-> Window" in the second. By what parameters / configuration can VisualStudio distinguish which project is currently open? My first bet was a .csproj file, but I don't see anything special in the type of project.

+4
source share
4 answers

The ProjectTypeGuids element is often present in the project file, which allows Visual Studio to determine the type of project. It is also listed in the solution file, referring to the project.

 <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 

as an example.

Here's a somewhat old link to the list of project commands, but most of them are still valid: http://onlinecoder.blogspot.se/2009/09/visual-studio-projects-project-type.html

And here is a blog post outlining everything he talks about:

http://www.dzimchuk.net/blog/post/ProjectTypeGuids-node-in-VS-project-files.aspx

"There is no ProjectTypeGuids node in the project of the usual class library. It did not take long to find out what these mysterious GUIDs are about: A list of well-known commands like the project. So, the first one talks about its WPF project, and the second one talks about its C # project.

+4
source

ProjectTypeGuids determine the type of project that Visual Studio recognizes. It is contained in the project file and the solution file. A project can belong to several types of projects, such as C # and VSTO.

WPF has a GUID {60dc8134-eba5-43b8-bcc9-bb4bc16c2548} , and WinForms has a GUID {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} with OutputType WinExe .

+4
source

This is actually a GUID in the .sln file that identifies the type of project.

 Project("{PROJECT-TYPE-GUID}") = "OurSolution.Tests.Integration", "OurSolution.Tests.Integration\OurSolution.Tests.Integration.csproj", "{04A96D9A-FF90-4FDC-9265-704CC8D496BE}" 
+1
source

Almost correctly, it is in the solution file. Search for ProjectTypeGuids property.

Here is a list of some GUIDs for project types: http://www.mztools.com/articles/2008/mz2008017.aspx

Edit: see this post for answers: How do you specify a Visual Studio project type from an existing Visual Studio project

+1
source

All Articles