21

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?

1

6 Answers 6

20

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

Sign up to request clarification or add additional context in comments.

3 Comments

Check my edit; I didn't find targetFramework anywhere in Web.config! Also, my Project properties doesn't quite look the same, as I'm using VS 2005.
In the <compilation> tag, do you have any assemblies added? Like this: <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>. You could also try to check the .Net version of IIS' ApplicationPool, which the application runs in. Check out this blog post by @ScottHanselman, it might give you some help.
Yes, I found 4 assemblies under <compilation>, two (System.Design and System.Windows.Forms) having Version=2.0.0.0 and two (System.Web.Extensions and System.Web.Extensions.Design) having Version=1.0.61025.0. I guess this answers my question. Thanks!
2

Check Your Web Config file.

In webconfig under <system.web>

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

this targetFramework is version

Comments

2

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.

Comments

0

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

Comments

0

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.