SNag
SNag

Reputation: 18151

How do I find the .NET version used in an existing project?

I am expected to continue development on a C#/ASP.NET project that has changed hands multiple times, and no one person is sure which version of .NET is being used.

Is there something (perhaps an option in Project properties or elsewhere) that tells me which version of .NET the project uses?

EDIT :

The project's hosted on a remote server (an ancient one!) which runs on Windows Server 2003, and uses Visual Studio 2005. I checked the Web.config file, and under <system.web>, I found <compilation debug="true"> but no entry for targetFramework !
Does the existence of this entry depend on the .NET version too? Is this 2.x or older?

Upvotes: 21

Views: 35361

Answers (6)

Gman Cornflake
Gman Cornflake

Reputation: 11

I've found that the fastest way to open the .csproj file, which shows the Target Framework, is to right click the project name in Solution Explorer, scroll down and click 'Unload Project'. This instantly open the .csproj file. Then just right click the project name and Reload the project.

Upvotes: 0

C_Sutt
C_Sutt

Reputation: 202

I found this in Visual Studio 2022 v17.7.4 by going to Project -> {Project Name} Properties -> Application -> General -> Target Framework. enter image description here

Upvotes: 0

Ram Ch. Bachkheti
Ram Ch. Bachkheti

Reputation: 2649

You can check .NET version of your project with the help of <TargetFrameworkVersion> tag in your .csproj file.

You can open .csproj form here: Right click on project => Open Folder in File Explorer => open .csproj in text editor.

Upvotes: 2

Didac Perez Parera
Didac Perez Parera

Reputation: 3834

You can found it in Project Properties or retrieve it at run-time with Environment.Version().

Upvotes: 0

khellang
khellang

Reputation: 18122

The tag in the project file is <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>.

Alternatively under project properties: enter image description here

If it is a web application, you can find it under Web.config: <compilation targetFramework="4.0">

Upvotes: 20

Harshit Tailor
Harshit Tailor

Reputation: 3281

Check Your Web Config file.

In webconfig under <system.web>

<httpRuntime targetFramework="4.5" />
<compilation debug="false" targetFramework="4.5" />

this targetFramework is version

Upvotes: 2

Related Questions