1

how to detect machine has at least DOTNET 2.0 or newer installed?

registry key preferred.

Tom
  • 6,725
  • 24
  • 95
  • 159
  • 1
    possible duplicate of [How to detect what .NET Framework versions and service packs are installed?](http://stackoverflow.com/questions/199080/how-to-detect-what-net-framework-versions-and-service-packs-are-installed) – slugster Sep 07 '10 at 11:13
  • I want to know if there is 2.0 or NEWER. – Tom Sep 07 '10 at 11:21
  • that answer gives you all the registry keys you can check for *any version* you like. Of course you only need to check for the v2.0.50727 one. Or you can start at v4.0 and work your way backwards until you get a hit. – slugster Sep 07 '10 at 11:52

6 Answers6

3

I would probably follow these instructions as they are from MS

http://support.microsoft.com/kb/315291

As mentioned in other answers this question seems like a good resource for finding our via the Registry. However, by looking at the OP comments, the easiest way would be to add a launch condition to your Setup & Deployment Package requesting the .NET Framework Version 2 or higher must be installed.

http://msdn.microsoft.com/en-us/library/xxyh2e6a.aspx

Community
  • 1
  • 1
codingbadger
  • 42,678
  • 13
  • 95
  • 110
  • That article dates from 2007, and while it may work there are some better (more established / more widely used and consequently better documented) ways of checking nowadays. – slugster Sep 07 '10 at 11:17
1
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727

Or for other versions example:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319
Svisstack
  • 16,203
  • 6
  • 66
  • 100
1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP seems to have a list of all the installed versions.

[EDIT: 2012-04-04] Useful MSDN knowledge base article with some graphics

noonand
  • 2,763
  • 4
  • 26
  • 51
1

This has been well covered before here on SO, this previous answer should be everything you need - worked for me when i used it (and it is well voted for, which is a measure of how reliable it is).

Community
  • 1
  • 1
slugster
  • 49,403
  • 14
  • 95
  • 145
  • well this gets a list of all versions, I want to detect during setupper if my CODE works, meaning if there is NET 2.0 or newer installed. – Tom Sep 07 '10 at 11:31
  • @Tom, so like i mentioned above, you don't have to check them all, just pick the one you want (although some of them do have to be checked in combination for an accurate answer - 3.5 also requires 3.0 and 2.0 to be installed). – slugster Sep 07 '10 at 11:55
0

As far as I know there is no registry key installed on the system by .NET that specifies "Hey, I am installed". However, you could simply check to see if the v2.0.50727 Registry Key exists, or you could check to see if the .NET folder exist on disk at "C:\Windows\Microsoft.NET\Framework\v2.0.50727".

Edit:

As 'slugster' pointed out, apparently .NET does install a registry value called 'Install' under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" with a DWORD value of '1' if the framework is installed. The rest follow the same pattern except for version .NET 4.0, which places this registry value under the registry subkey named 'Full' or 'Client', which I am assuming one is for the Client Profile and the other is self-explanatory.

David Anderson
  • 13,558
  • 5
  • 50
  • 76
  • Checking for the existence of a folder is no guarantee that the framework is installed. Also the framework install status **does** get entered in the registry. – slugster Sep 07 '10 at 11:13
0

I noticed its best to check if this Reg key exists:

Software\Microsoft.NETFramework\policy\v2.0

If its not there I will install DOTNET.

Tom
  • 6,725
  • 24
  • 95
  • 159