Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how visualstudio knows about the type of current project?

In Visual Studio, the context menu command for adding an element in a WinForms project is different by the one showed for a WPF project. In fact, I can see "Add->Windows Form" in the first and "Add->Window" in the second. By which parameter/configuration VisualStudio can differentiate which kind of project is currently opened? My first bet was the .csproj file but I can see nothing distinctive about the project type.

like image 568
Aiguil Leblanc Avatar asked Dec 26 '22 20:12

Aiguil Leblanc


2 Answers

There is often a ProjectTypeGuids element in the project file that allows Visual Studio to determine what project type it is. It's also stated in the solution file, referencing the project.

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

as an example.

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

And here's a blogpost, outlining what it's all about:

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

"On a regular class library project the ‘ProjectTypeGuids’ node was missing at all. It didn’t take long to find what those mysterious GUID’s are about: List of known project type Guids. So the first one says it’s a WPF project and the second one says it’s a C# project."

like image 194
J. Steen Avatar answered Jan 09 '23 07:01

J. Steen


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

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

like image 28
SliverNinja - MSFT Avatar answered Jan 09 '23 07:01

SliverNinja - MSFT