How do you tell the Visual Studio project type fro

2019-01-06 13:30发布

Using Visual Studio 2005.

Is there anything in the .sln or .vcproj files (or anywhere else) that defines the project type / subtype?

Edit: What I mean is that when you create a project, you first choose a language (e.g. Visual C#), then a project type (e.g. Windows) and then a subtype (e.g. Console Application).

Where is this information stored within the VS files?

5条回答
劳资没心,怎么记你
2楼-- · 2019-01-06 14:14

The .vproj file defines the project type, for example, the following defines a C++ project.

<VisualStudioProject
   ProjectType="Visual C++"

The project tag also includes the compiler version.

查看更多
萌系小妹纸
3楼-- · 2019-01-06 14:14

Double-click on "My Project" in the Solution Explorer, and look at the "Application type:" ComboBox. It tells you (and lets you change) the project type.

查看更多
倾城 Initia
4楼-- · 2019-01-06 14:18

In the project XML files:

Console applications contain:

<OutputType>Exe</OutputType>

WinForms applications contain:

<OutputType>WinExe</OutputType>

Library (.dll) projects contain:

<OutputType>Library</OutputType>

and do NOT contain a

<ProjectTypeGuids>

ASP.NET and WCF projects contain:

<ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>

The GUIDs do something to define exactly what type of project it is. The ones above were taken from an ASP.NET app. They exist in WCF projects too, and flipping around the GUIDs can fool Vis Studio into changing the project type when you open it.

查看更多
孤傲高冷的网名
5楼-- · 2019-01-06 14:22

Some further research and I found this:

INFO: List of known project type Guids.

My .sln file contains:

Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddNumbers", "AddNumbers.csproj", "{2C81C5BB-E3B0-457E-BC02-73C76634CCD6}"

The link shows:

Project Type Description Project Type Guid
Windows (C#) {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

So it's Windows C# and the subtype is as per @HardCode's reply. In my case, it's "Console Application".

查看更多
何必那么认真
6楼-- · 2019-01-06 14:27

If you are interested in finding subtypes of a project i.e. Under C# Windows Project Category, checking whether it is a Windows Form Application or WPF

Try adding new item in the project and it will show you the items specific to that project type along with default options.

For instance if there is a WPF project it shows the WPF related options like 'Window' , 'Page' 'User Control' ... In case of Window Form Application it Shows 'Window Form' etc.....

查看更多
登录 后发表回答