开发者

How to determine the project type in Visual Studio?

开发者 https://www.devze.com 2023-03-26 09:37 出处:网络
How can one determine the "type" of a project in Visual Studio? For example, if a project is a class library, a web application project, a WinForms project, a WCF project, etc. The icons are

How can one determine the "type" of a project in Visual Studio?

For example, if a project is a class library, a web application project, a WinForms project, a WCF project, etc. The icons are obviously different开发者_Python百科 for a lot of them, but is there anywhere where it states the project type?


One simple trick is drag and drop project file in notepad and where you can see this kind of stuff<

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>`enter code here`
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{27F8327B-239F-4125-809C-13FB6209D2E3}</ProjectGuid>
    <OutputType>WinExe</OutputType>`enter code here`
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>WpfApplication1</RootNamespace>
    <AssemblyName>WpfApplication1</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

Compare "ProjectTypeGuid" with this Link. by changing this guid you can add WPF window to WinForms project.


If the .csproj file has no <ProjectTypeGuids>

As Alex McMillan has pointed out, you could not be able to find the <ProjectTypeGuids> element.

The first answer is correct, except for .dll Library Projects, Console Applications and WinForms Applications as far I know.

They contain <OutputType> (followed by: Library or Exe or WinExe)

and do not contain <ProjectTypeGuids>.


I think if you go to the properties window of your project you will see the information following this image below.

How to determine the project type in Visual Studio?

Please look at the output type. It shows Class library. If your project shows windows application then the output is a Windows Application.


Programmatically, using the EnvDTE namespace, you can investigate the Project.Kind property of the Visual Studio project.

However, if you're interested in a more detailed, the project specification file, i.e. the *.csproj, *.vbproj, among others describes the kind of the project in an XML way.


Easy solution.

If you want to know if it's a WCF Project or ASP.NET Web Service simply open your project's folders in File Explorer. You can hover over the icon with your mouse and a tooltip will display the project type as shown in the picture. Also, you can look under the Type column in File Explorer and it shows it there as well.

WCF Web Service Project:

How to determine the project type in Visual Studio?

ASP.NET Web Service Project:

How to determine the project type in Visual Studio?

Also to note, if your project has a Resources.Designer.cs or Settings.Designer.cs in its Properties folder it's likely a WinForms application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号