Find Dot Net Frameworks on Win32 PC using C++

11/12/2010 Update
Added support for 4.0 Framework.
Updated code sample (VS 2010) can be found here:
http://wadesword.org/code/files/CheckDotNetInstall.zip
Compiled exe only can be found here:
http://wadesword.org/code/files/CheckDotNetInstallExe.zip

Original Information
I had a request to find what current dot net frameworks are  installed on a given PC (Win 32). I found an example in C++ here:

http://blogs.msdn.com/astebner/archive/2007/11/29/6608419.aspx

C++ source code is here for the above example:

http://astebner.sts.winisp.net/Tools/detectfx_new.cpp.txt

I modified the code above to return the results to the command line. The original code displays the results in a message box for each framework.

If you want to test just the exe file, you can download it here:

download
http://wadesword.org/code/files/CheckDotNetInstallExe_old.zip

The full C++ source code is here (I used VS 2008):


http://wadesword.org/code/files/CheckDotNetInstall_old.zip

From the command line type “CheckDotNetInstall false” to  get results in the command window, as shown below:

Running CheckDotNetInstall with no parameters will display a message box for each framework. This is changed in the new version, no message prompts are displayed. The code would need to be modified to change this behavior, please see header text of main code module for details.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.