visual-studio 如何在visual studio中确定项目类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1031952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to determine the project type in visual studio
提问by raklos
How can you determine the "type" of a project in Visual Studio?
如何在 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 for a lot of them, but is there anywhere where it states the project type?
例如,如果一个项目是一个类库、一个 Web 应用程序项目、一个 WinForms 项目、一个 WCF 项目等。它们中的很多图标明显不同,但是有没有什么地方可以说明项目类型?
回答by user781700
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>
一个简单的技巧是在记事本中拖放项目文件,在那里你可以看到这种东西<
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>在此处<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>输入代码 在此处输入代码<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 guids you can add wpf window to winforms project.
将“ProjectTypeGuid”与此链接进行比较。通过更改此 guid,您可以将 wpf 窗口添加到 winforms 项目。
回答by Marco D.G.
If the .csprojfile has no <ProjectTypeGuids>
如果.csproj文件没有<ProjectTypeGuids>
As Alex McMillan has pointed out, you could not be able to find the <ProjectTypeGuids>element.
正如 Alex McMillan 指出的那样,您无法找到该<ProjectTypeGuids>元素。
The first answer is correct, except for .dllLibrary Projects, Console Applicationsand WinForms Applicationsas far I know.
第一个答案是正确的,据我所知,除了.dllLibrary Projects、Console Applications和WinForms Applications。
They contain <OutputType>(followed by: Libraryor Exeor WinExe)
它们包含<OutputType>(后跟:Library或Exe或WinExe)
and do notcontain <ProjectTypeGuids>.
并且不包含 <ProjectTypeGuids>.
回答by Paulo Santos
Programmatically, using the EnvDTEnamespace, you can investigate the Project.Kindproperty of the Visual Studio project.
以编程方式,使用EnvDTE命名空间,您可以调查Project.KindVisual Studio 项目的属性。
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.
但是,如果你有兴趣在一个更详细的项目规范文件,即*.csproj,*.vbproj等等描述了一种以XML方式的项目。
回答by Hassanuzzaman
I think if you go to the properties window of your project you will see the information following this image below.
我想如果您转到项目的属性窗口,您将看到下面这张图片后面的信息。


Please look at the output type. It shows Class library. If your project shows windows application then the output is a Windows Application.
请查看输出类型。它显示类库。如果您的项目显示 Windows 应用程序,则输出是一个 Windows 应用程序。

