none
How do i detect if .net 3.5 is installed? RRS feed

  • Question

  • I need to detect if .net 3.5 is installed.
    What is the best/most robust way of doing this?

    I could read the registry. But that doesn't sound very robust. And ia have read that if you uninstall .net 3.5 the registry keys could still exist.

    Enviroment.Version only gives me: 2.0.50727.3082. But i dont want to have a list of know version that are 3.5 version in my code.

    So what other options are there?

    Regards

    "Life would be much easier if i only had the sourcecode"
    Monday, June 1, 2009 12:26 PM

Answers

  • Hi,

    You can tell if the .NET Framework has been installed by looking for the MSCorEE.dll file in the %SystemRoot%\system32 directory. The existence of this file tells you that the .NET Framework is installed. However, several versions of the .NET Framework can be installed on a single machine simultaneously. If you want to determine exactly which versions of the .NET Framework are installed, examine the subkeys whose names start with the lowercase letter "v" and are followed by a number under the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy

    If .Net Framework 3.5 is installed, you will find its entry in the above registry key.

    Hope it helps,
    Sumit

    [Please do not forget to mark as answer for a correct reply.]

    Tuesday, June 2, 2009 4:46 AM

All replies

  • You'll have to read the registry.  Environment.Version gives you the CLR version, not the framework version.  It would be a bit hard to use too, you'd need .NET installed.  Uninstalling .NET and still having the registry keys would be a corruption of the registry.  You cannot possibly deal with every possible way a machine can be corrupted.  Don't try.

    Hans Passant.
    Monday, June 1, 2009 1:54 PM
    Moderator
  • Monday, June 1, 2009 2:07 PM
  • Hi,

    You can tell if the .NET Framework has been installed by looking for the MSCorEE.dll file in the %SystemRoot%\system32 directory. The existence of this file tells you that the .NET Framework is installed. However, several versions of the .NET Framework can be installed on a single machine simultaneously. If you want to determine exactly which versions of the .NET Framework are installed, examine the subkeys whose names start with the lowercase letter "v" and are followed by a number under the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy

    If .Net Framework 3.5 is installed, you will find its entry in the above registry key.

    Hope it helps,
    Sumit

    [Please do not forget to mark as answer for a correct reply.]

    Tuesday, June 2, 2009 4:46 AM