Sometimes you might want a quick way to check what .NET frameworks are installed on a machine, and whether they are properly working. Microsoft provides a KB article documenting the registry keys required to detect .NET installation here:
However just using the registry key is not always enough, sometimes it has been installed but files are missing or not working properly. So what I did was I created some very simple .NET EXEs using C#, each one using a different framework i.e. 2.0, 3.0, 3.5/etc. In addition I created console/windows form/and WPF version. For example Windows Forms may work, but additional files are required to test WPF. This .NET installation checks if .NET is installed – then if it a particular version is detected it will try to launch the .NET application, if it loads it will return 0. If it crashes / framework corrupt it will not return 0 and you will get a dialog box with error message why it failed. If NGEN.exe is in the Framework directory I also test that, as I’ve seen cases when a .NET app loads, but NGEN fails.
This is by no means a fool proof method…there are many more files/registry settings we could check to ensure .NET is properly working. If anybody has any suggestions what else we should check for, I’ll add it into the utility.
To ensure simplicity, portability I’ve written this tool using AutoIT, with the .NET checker utilities running in C#. The .NET check all are just a default app with the only code being Environment.Exit(0) These are embedded into the .EXE
The utility and AutoIT source code is available here: http://tiange.com.au/NETChecker.zip
(Note: although this will run on x64 windows, it doesn’t fully test the x64+x86 .NET frameworks)
If you make any improvements please share with me.