Before starting my application (on Form Load) I want to check and ensure that the .NET framework (3.5 or higher) are installed on the machine - if not I want to prompt the user to download and install it (simple MessageBox with a INTERNET LINK to the Microsoft WebPage would be the best idea no?) So, this actually entails two questions...
a) How do I DETERMINE IF .NET FrameWork 3.5 or higher are installed? (I don't trust or want to just look for the C:\Program Files\Microsoft.NET folder, seems error-prone no?) Seeing as this is so very crucial there must be a nice way in C# to determine what version of .NET the user has running on his machine? I just have no clue how..
b) HOW do I paste an INTERNET LINK (hyperlink?) in a MessageBox? So that if the user does NOT have the .NET framework (1.1 or 2.0) installed I can have them simply click on the link to go download it?
Any help/hints would be greatly appreciated.
Thanks, Din
The version of .NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Full subkey is missing, then .NET Framework 4.5 or above isn't installed.
Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to determine the version of . NET installed and press Enter: reg query "HKLM\SOFTWARE\Microsoft\Net Framework Setup\NDP" /s.
a) You would have to bootstrap the program with a non .NET language (C++, VB6, etc) instead of Form_Load (other posters are correct - if the framework isn't installed, the .NET program won't run). An example is here:
http://www.codeproject.com/KB/mcpp/DotNetTester.aspx
b) You can't put a hyperlink in a MessageBox, so you would have to create your own popup dialog (a form). EDIT: That form / dialog would have to be in the bootstrap program.
You can not do this from your application. The application will fail to start.
One option you can do is make a ClickOnce installation that will verify that .NET is installed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With