3

I want to develop a .NET application in c# but first i need to check
that the .NET framework is installed , because i don't want user see any error.
so is there any vc++ code that only use MFC in a static Library to check if .NET framework is installed ?

LMCompany
  • 111
  • 3
  • 8
  • 1
    You may check this in installer. There are plugins for all popular installers to check this. – acoolaum May 23 '12 at 06:09
  • Which is the lowest Windows version you support? Depending on that the .NET framework (in at least version 2.0) will usually be installed. Concerning: "I don't want user see any error". What else do you want to happen when you, hypothetically, have detected that the .NET framework is not present? Silently install it? – Christian.K May 23 '12 at 06:11
  • Additionally, you may add the framework installation into your installer after check. – acoolaum May 23 '12 at 06:11
  • 1
    possible duplicate of [How do I tell if .NET 3.5 SP1 is installed?](http://stackoverflow.com/questions/198931/how-do-i-tell-if-net-3-5-sp1-is-installed) – razlebe May 23 '12 at 06:16

2 Answers2

5

You can use the registry to check about .net framework and it's version, Either you you use VC++ or some other language that can handle registry..

Check Micrsoft Knowledge Base Article - How to determine which versions and service pack levels of the Microsoft .NET Framework are installed

There are various way suggested on SO thread.

Another one is using the Signum.Utilities library from SignumFramework (wich you can use stand-alone), you can get it nicely and without dealing with the registry by yourself.

Edit: Check this code project article - Is .NET Framework installed on this machine???, it is also using registry to get the framework installed or not..

Hope this help..

Community
  • 1
  • 1
Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75
-1
  1. Check if the file MSCorEE.dll is present in the %SystemRoot%\System32 directory.
  2. Also the .Net Framework SDk includes a utility called CLRver.exe which shows versions of .Net framework installed on your machine
Not a bug
  • 4,286
  • 2
  • 40
  • 80