Cek Versi Dot Net Komputer

Posted : admin On 21.07.2019

The problem is that I need to know if it's version 3.5 SP 1. Environment.Version() only returns 2.0.50727.3053.

I found this solution, but I think it will take much more time than it's worth, so I'm looking for a simpler one. Is it possible?

Peter Mortensen

Cara cek spesifikasi komputer di linux dapat dilakukan dengan cara yang cukup mudah dengan menggunakan Terminal. Cara mengetahui spesifikasi komputer/laptop anda dilakukan dengan cara mengettikan perintah dasar Linux yang akan memberikan informasi balik kepada kita tentang apa saja informasi yang anda butuhkan lengkap mengenai spek komputer anda seperti spesifikasi Processor, RAM, dan juga. 2.Meminimaliasi proses software deployment dan menghindari konflik penggunaan versi software yang di buat. 3.Untuk menyediakan environment kerja yang aman dalam hal pengeksekusian kode, termasuk kode yang dibuat oleh pihak ketiga. 4.Mengurangi masalah pada persoalan performa dari kode atau dari lingkungan interpreternya. Check Your DOTNET. How to check what versions of.NET you have on your computer: There are many ways to check what version of.NET (DOTNET) you have.

14.2k19 gold badges88 silver badges115 bronze badges
CarloCarlo
16.2k26 gold badges117 silver badges169 bronze badges

20 Answers

Something like this should do it. Just grab the value from the registry

For .NET 1-4:

Framework is the highest installed version, SP is the service pack for that version.

For .NET 4.5+ (from official documentation):


Not sure why nobody suggested following the official advice from Microsoft right here.

This is the code they recommend. Sure it's ugly, but it works.

For .NET 1-4

For .NET 4.5 and later

Mathias Lykkegaard LorenzenMathias Lykkegaard Lorenzen
7,05818 gold badges74 silver badges145 bronze badges

An alternative method where no right to access the registry are needed, is to check for the existence of classes that are introduced in specific framework updates.

mwijnandsmwijnands

Environment.Version() is giving the correct answer for a different question. The same version of the CLR is used in .NET 2.0, 3, and 3.5. I suppose you could check the GAC for libraries that were added in each of those subsequent releases.

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
quillbreakerquillbreaker
4,9003 gold badges23 silver badges44 bronze badges

AFAIK there's no built in method in the framework that will allow you to do this. You could check this post for a suggestion on determining framework version by reading windows registry values.

Darin DimitrovDarin Dimitrov
865k231 gold badges3053 silver badges2774 bronze badges

It used to be easy, but Microsoft decided to make a breaking change: Before version 4.5, each version of .NET resided in its own directory below C:WindowsMicrosoft.NETFramework (subdirectories v1.0.3705, v1.1.4322, v2.0.50727, v3.0, v3.5 and v4.0.30319).

Since version 4.5 this has been changed: Each version of .NET (i.e. 4.5.x, 4.6.x, 4.7.x) is being installed in the same subdirectory v4.0.30319 - so you are no longer able to check the installed .NET version by looking into Microsoft.NETFramework.

To check the .NET version, Microsoft has provided two different sample scripts depending on the .NET version that is being checked, but I don't like having two different C# scripts for this. So I tried to combine them into one, here's the script I created (and updated it for 4.7.1 framework):

On my machine it outputs:

v2.0.50727 2.0.50727.4927 SP2
v3.0 3.0.30729.4926 SP2
v3.5 3.5.30729.4926 SP1
v4
Client 4.7.03056
Full 4.7.03056
v4.0
Client 4.0.0.0
.NET Framework Version: 4.7.2 or later
**** Maximum .NET version number found is: 4.7.2 or later ****

The only thing that needs to be maintained over time is the build number once a .NET version greater than 4.7.1 comes out - that can be done easily by modifying the function CheckFor45PlusVersion, you need to know the release key for the new version then you can add it. For example:

This release key is still the latest one and valid for the Fall Creators update of Windows 10. If you're still running other (older) Windows versions, there is another one as per this documentation from Microsoft:

.NET Framework 4.7.1 installed on all other Windows OS versions 461310

So, if you need that as well, you'll have to add

to the top of the function CheckFor45PlusVersion.Likewise it works for newer versions. For example, I have added the check for 4.8 recently. You can find those build numbers usually at Microsoft.

Note: You don't need Visual Studio to be installed, not even PowerShell - you can use csc.exe to compile and run the script above, which I have described here.

Update: The question is about the .NET Framework, for the sake of completeness I'd like to mention how to query the version of .NET Core as well - compared with the above, that is easy: Open a command shell and type:

dotnet --infoEnter

and it will list the .NET Core version number, the Windows version and the versions of each related runtime DLL as well.Sample output:

.NET Core SDK (reflecting any global.json):
Version: 2.1.300
Commit: adab45bf0c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk2.1.300
Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba
.NET Core SDKs installed:
1.1.9 [C:Program Filesdotnetsdk]
2.1.102 [C:Program Filesdotnetsdk]
...
2.1.300 [C:Program Filesdotnetsdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:Program
FilesdotnetsharedMicrosoft.AspNetCore.All]
...
Microsoft.NETCore.App 2.1.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Note that

  • if you only need the version number without all the additional information, you can use
    dotnet --version.

  • on a 64 bit Windows PC, it is possible to install the x86 version side by side with the x64 version of .NET Core. If that is the case, you will only get the version that comes first in the environment variable PATH. That is especially important if you need to keep it up to date and want to know each version. To query both versions, use:

    C:Program Filesdotnetdotnet.exe --version
    3.0.100-preview6-012264
    C:Program Files (x86)dotnetdotnet.exe --version
    3.0.100-preview6-012264

In the example above, both are the same, but if you forgot to update both instances, you might get different results! Note that Program Files is for the 64bit version, and Program Files (x86) is the 32bit version.

MattMatt
16.3k7 gold badges75 silver badges116 bronze badges

This class allows your application to throw out a graceful notification message rather than crash and burn if it couldn't find the proper .NET version. All you need to do is this in your main code:

By default it takes 4.5.2, but you can tweak it to your liking, the class (feel free to replace MessageBox with Console):

Updated for 4.8:

Easily extendable when they add a new version later on. I didn't bother with anything before 4.5 but you get the idea.

Royi Namir
78.6k104 gold badges345 silver badges614 bronze badges
codenamezerocodenamezero

Thank you for this post which was quite useful.I had to tweak it a little in order to check for framework 2.0 because the registry key cannot be converted straightaway to a double. Here is the code:

Fahim Parkar
21k34 gold badges136 silver badges243 bronze badges
pasxpasx
D.A.R.T.S.D.A.R.T.S.

using class DA.VersionNetFramework

Result:

Current OS Information:Machine Name: D1Platform: Win32NTMicrosoft Windows NT 6.2.9200.0

.NET Framework Environment Information:Environment.Version 4.0.30319.42000.NET 4.6 on Windows 8.1 64 - bit or later

.NET Framework Information From Registry: v2.0.50727 2.0.50727.4927 SP2v3.0 3.0.30729.4926 SP2 v3.5 3.5.30729.4926 SP1

v4
Client 4.6.00079 Full 4.6.00079v4.0
Client 4.0.0.0

.NET Framework 4.5 or later Information From Registry:Version: 4.6 installed with Windows 10 or later

Update HistoryMicrosoft .NET Framework 4 Client Profile
KB2468871
KB2468871v2
KB2478063
KB2533523
KB2544514
KB2600211
KB2600217
Microsoft .NET Framework 4 Extended
KB2468871
KB2468871v2
KB2478063
KB2533523
KB2544514
KB2600211
KB2600217
Microsoft .NET Framework 4 Multi-Targeting Pack
KB2504637 Update for (KB2504637)

D.A.R.T.S.D.A.R.T.S.

I have changed Matt's class so it can be reused in any project without printing all its checks on Console and returning a simple string with correct max version installed.

HikariHikari
1,4888 gold badges32 silver badges55 bronze badges

I tried to combine all the answers into a single whole.

Using:

NetFrameworkUtilities.GetVersion() will return the currently available Version of the .NET Framework at this time or null if it is not present.

This example works in .NET Framework versions 3.5+. It does not require administrator rights.

I want to note that you can check the version using the operators < and > like this:

Code:

Konstantin S.Konstantin S.

Update with .NET 4.6.2. Check Release value in the same registry as in previous responses:

Alt-WNAlt-WN
user885959user885959

Little large, but looks like it is up-to-date to Microsoft oddities:

zDougiezDougie

As of version 4.5 Microsoft changed the way it stores the .NET Framework indicator in the registry. There official guidance on how to retrieve the .NET framework and the CLR versions can be found here: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx

I am including modified version of their code to address the bounty question of how you determine the .NET framework for 4.5 and higher here:

Semicolons and Duct TapeCek Versi Dot Net KomputerSemicolons and Duct Tape
1,4751 gold badge13 silver badges32 bronze badges
Morten NilsenMorten Nilsen
Martin.MartinssonMartin.Martinsson

If your machine is connected to the internet, going to smallestdotnet, downloading and executing the .NET Checker is probably the easiest way.

If you need the actual method to deterine the version look at its source on github, esp. the Constants.cs which will help you for .net 4.5 and later, where the Revision part is the relvant one:

mbxmbx
4,0535 gold badges49 silver badges80 bronze badges

I had a situation where my .NET 4.0 class library might be called from an .NET 4.0 or higher version assemblies.

A specific method call would only work if executed from an 4.5+ assembly.

In Order to decide if I should call the method or not I needed to determine the current executing framework version and this is a pretty good solution for that

Jürgen SteinblockJürgen Steinblock
19.9k18 gold badges85 silver badges155 bronze badges

Not the answer you're looking for? Browse other questions tagged c#.net or ask your own question.

How do I find out which version of .NET is installed?

I'm looking for something as simple as 'java -version' that I can type at the command prompt and that tells me the current version(s) installed.

I better add that Visual Studio may not be installed - this is typically something that I want to know about a client machine.

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
sepangsepang
1,9503 gold badges17 silver badges23 bronze badges

17 Answers

Just type any one of the below commands to give you the latest version in the first line.

You can only run these from the Visual Studio Command prompt if you have Visual Studio installed, or else if you have the .NET framework SDK, then the SDK Command prompt.

The last command (5) will list out all the versions (except 4.5) of .NET installed, latest first.
You need to run the 4th command to see if .NET 4.5 is installed.

Another three options from the PowerShell command prompt is given below.

The last command (8) will give you all versions, including .NET 4.5.

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
Binoj AntonyBinoj Antony
13.1k24 gold badges82 silver badges94 bronze badges

There is an easier way to get the exact version .NET version installed on your machine from a cmd prompt. Just follow the following instructions;

  1. Open the command prompt (i.e Windows + R → type 'cmd').
  2. Type the following command, all on one line:

reg query 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP'

(This will list all the .NET versions.)

  1. If you want to check the latest .NET 4 version.
  2. Type following instruction, on a single line:

reg query 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4full' /v version

Please find the attached image below to see how it is shown.

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
AnandShanbhagAnandShanbhag
3,8451 gold badge12 silver badges13 bronze badges

.NET Version Detector is a GUI utility that displays which of the six(!) versions of the framework are installed.

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
Phil DevaneyPhil Devaney
15.3k5 gold badges36 silver badges29 bronze badges

Dot Internet

Before going to a command prompt, please follow these steps...

Open My Computer → double click 'C:' drive → double click 'Windows' → double click 'Microsoft.NET' → double click 'Framework' → Inside this folder, there will be folder(s) like 'v1.0.3705' and/or 'v2.0.50727' and/or 'v3.5' and/or 'v4.0.30319'.

Your latest .NET version would be in the highest v number folder, so if v4.0.30319 is available that would hold your latest .NET framework. However, the v4.0.30319 does not mean that you have the .NET framework version 4.0. The v4.0.30319 is your Visual C# compiler version, therefore, in order to find the .NET framework version do the following.

Go to a command prompt and follow this path:

C:WindowsMicrosoft.NETFrameworkv4.0.30319 (or whatever the highest v number folder)

C:WindowsMicrosoft.NETFrameworkv4.0.30319 > csc.exe

Output:

Microsoft (R) Visual C# Compiler version 4.0.30319.17929for Microsoft (R) .NET Framework 4.5Copyright (C) Microsoft Corporation. All rights reserved.

Example below:

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
Sunimal KaluarachchiSunimal Kaluarachchi

For the version of the framework that is installed, it varies depending on which service packs and hotfixes you have installed. Take a look at this MSDN page for more details. It suggests looking in %systemroot%Microsoft.NETFramework to get the version.

Environment.Version will programmatically give you the version of the CLR.

Note that this is the version of the CLR, and not necessarily the same as the latest version of the framework you have installed (.NET 3.0 and 3.5 both use v2 of the CLR).

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
adrianbanksadrianbanks
68.1k18 gold badges150 silver badges188 bronze badges

MSDN details it here very nicely on how to check it from registry:

To find .NET Framework versions by viewing the registry (.NET Framework 1-4)

  1. On the Start menu, choose Run.
  2. In the Open box, enter regedit.exe.You must have administrative credentials to run regedit.exe.
  3. In the Registry Editor, open the following subkey:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP

The installed versions are listed under the NDP subkey. The version number is stored in the Version entry. For the .NET Framework 4 the Version entry is under the Client or Full subkey (under NDP), or under both subkeys.

To find .NET Framework versions by viewing the registry (.NET Framework 4.5 and later)

  1. On the Start menu, choose Run.
  2. In the Open box, enter regedit.exe. You must have administrative credentials to run regedit.exe.
  3. In the Registry Editor, open the following subkey:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full

Note that the path to the Full subkey includes the subkey Net Framework rather than .NET Framework

Check for a DWORD value named Release. The existence of the Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer.

Note: The last row in the above snapshot which got clipped reads On all other OS versions: 461310. I tried my level best to avoid the information getting clipped while taking the screenshot but the table was way too big.

RBTRBT
10.2k7 gold badges83 silver badges111 bronze badges

If you open a command prompt and type the following two commands, all framework versions that are installed on the current machine will be listed (each one is stored in a separate directory within this directory).

Peter Mortensen
14.2k19 gold badges88 silver badges115 bronze badges
Michael ArnellMichael Arnell
8331 gold badge8 silver badges16 bronze badges

Just type the following in the command line:

Your dotnet version will be shown as the highest number.

Dov Benyomin Sohacheski
2,8795 gold badges21 silver badges44 bronze badges
Steve JuniorSteve Junior
Udo Held
9,54311 gold badges52 silver badges80 bronze badges
FelixAVerasFelixAVeras

To just get the installed version(s) at the command line, I recommend using net-version.

  • It's just a singlebinary.
  • It uses the guidelines provided myMicrosoftto get version information.
  • It doesn't require the SDK to be installed.
  • Or the Visual Studio command prompt.
  • It doesn't require you to use regedit and hunt down registry keysyourself. You can even pipe the output in a command line tool ifyou need to.

Source code is available on github.com

Full disclosure: I created this tool myself out of frustration.

Dan EsparzaDan Esparza
20.1k25 gold badges89 silver badges124 bronze badges
A.IA.I
9431 gold badge9 silver badges16 bronze badges

clrver is an excellent one. Just execute it in the .NET prompt and it will list all available framework versions.

James PouloseJames Poulose

If you do this fairly frequently (as I tend to do) you can create a shortcut on your desktop as follows:

  1. Right click on the desktop and select NewShortcut.
  2. In the location field, paste this string: powershell.exe -noexit -command 'gci 'HKLM:SOFTWAREMicrosoftNET Framework SetupNDP' -recurse gp -name Version,Release -EA 0 where { $_.PSChildName -match '^(?!S)p{L}'} select PSChildName, Version, Release' (this is from Binoj Antony's post).
  3. Hit Next. Give the shortcut a name and Finish.

(NOTE: I am not sure if this works for 4.5, but I can confirm that it does work for 4.6, and versions prior to 4.5.)

Community
kmotekmote
11.5k8 gold badges52 silver badges78 bronze badges

For anyone running Windows 10 1607 and looking for .net 4.7.Disregard all of the above.

It's not in the Registry, C:WindowsMicrosoft.NET folder or the Installed Programs list or the WMIC display of that same list.

Look for 'installed updates' KB3186568.

skrieskrie
Dot net tutorialspoint

Per Microsoft in powershell:

See the table at this link to get the DWORD value to search for specific versions:

lightwinglightwing

How To Check .net Framework Version Cmd

If you'r developing some .Net app (for ex. web app), you can make 1 line of error code (like invoke wrong function name) and reload your page, the .Net version will be show

Sy C DangSy C Dang

Cek Versi Dot Net Komputer Download

There is an easier way to get the exact version .NET version installed on your machine from a cmd prompt. Just follow the following instructions;

Open the command prompt (i.e Windows + R → type “cmd”) and type the following command, all on one line: %windir%Microsoft.NETFrameWork, and then navigating to the directory with the latest version number.

Refer to http://dotnettec.com/check-dot-net-framework-version/

JuliaJulia

Not the answer you're looking for? Browse other questions tagged .net or ask your own question.