检查 C# 项目的 VS 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8829542/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 04:41:16  来源:igfitidea点击:

Check VS version of a C# Project

c#visual-studio

提问by

I have a completed C# Visual Studio project but I am not able to open it due to version issue of the Visual Studios.

我有一个完整的 C# Visual Studio 项目,但由于 Visual Studios 的版本问题,我无法打开它。

I have tried using VS2005 and VS2010, but both are unable to open the project.

我曾尝试使用VS2005和VS2010,但都无法打开项目。

I met errors while converting the project in VS2010 as well.

我在 VS2010 中转换项目时也遇到了错误。

Is there any file which I could locate the version of VS used?

是否有任何文件可以找到所使用的 VS 版本?

__

__

EDIT:

编辑:

Thank you for the advices.

谢谢你的建议。

I have look through my csproj file as advised:

我已经按照建议查看了我的 csproj 文件:

<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

From what I see, the VS ver. used is most likely to be 2003 ver.

据我所知,VS ver。使用的最有可能是 2003 版。

Please correct me if I am wrong.

如果我错了,请纠正我。

回答by Ben Voigt

The beginning of a project file looks like this:

项目文件的开头如下所示:

<?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>

Either the ToolsVersionattribute or ProductVersiontag should lead you to the version of Visual Studio.

无论是ToolsVersion属性或ProductVersion标签应导致你的Visual Studio版本。

回答by Bryan Naegele

Open the csproj file with notepad. There should be a line in there.

用记事本打开 csproj 文件。那里应该有一条线。

You are correct. It's Visual Studio 2003.

你是对的。它是 Visual Studio 2003。

回答by JKor

Open up the .sln file in a text editor such as notepad. The version should be in the first few lines following a "#" symbol.

在记事本等文本编辑器中打开 .sln 文件。版本应在“#”符号后的前几行中。

回答by Andrey

To add to Ben's answer, you can take a look at project types, in the same csproj file, they will look like this:

要添加到 Ben 的答案中,您可以查看项目类型,在同一个 csproj 文件中,它们将如下所示:

<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

It's possible that the project you are trying to open is using some project type that you don't have installed (like web deployment project or a version of MVC higher than what you have etc.) You can google each of teh GUID's in the ProjectTypeGuids to see what's missing.

您尝试打开的项目可能正在使用您尚未安装的某些项目类型(例如 Web 部署项目或比您拥有的版本更高的 MVC 版本等)您可以在 ProjectTypeGuids 中搜索每个 GUID看看缺少什么。

回答by NeerajH

Look for the value in the <ProductVersion>tag in your project's csproj file.

<ProductVersion>在项目的 csproj 文件中的标记中查找值。

Here's a table with each product name and its corresponding version:

这是一个包含每个产品名称及其对应版本表格

+---------------------------+---------------+-----------+----------------+
|       Product name        |   Codename    | Version # | .NET Framework | 
+---------------------------+---------------+-----------+----------------+
| Visual Studio 4.0         | N/A           | 4.0.*     | N/A            |
| Visual Studio 97          | Boston        | 5.0.*     | N/A            |
| Visual Studio 6.0         | Aspen         | 6.0.*     | N/A            |
| Visual Studio .NET (2002) | Rainier       | 7.0.*     | 1              |
| Visual Studio .NET 2003   | Everett       | 7.1.*     | 1.1            |
| Visual Studio 2005        | Whidbey       | 8.0.*     | 2.0, 3.0       |
| Visual Studio 2008        | Orcas         | 9.0.*     | 2.0, 3.0, 3.5  |
| Visual Studio 2010        | Dev10/Rosario | 10.0.*    | 2.0 – 4.0      |
| Visual Studio 2012        | Dev11         | 11.0.*    | 2.0 – 4.5.2    |
| Visual Studio 2013        | Dev12         | 12.0.*    | 2.0 – 4.5.2    |
| Visual Studio 2015        | Dev14         | 14.0.*    | 2.0 – 4.6      |
+---------------------------+---------------+-----------+----------------+