Determine if .NET Framework is installed
-
I want to distribute an application to people who may or may not have the .NET Framework installed. Currently, I have created a project that includes the application and the .NET Framework. The .NET framework is installed if it is currently not installed. However this leads to a large distribution file (I would like to email my application). As the .NET Framework is only needed to be installed once, any subsequent release containing the .NET Framework would be a waste. I would prefer to determine if the .NET Framework is installed. If not I would display a popup to tell the user to download the framework from the Microsoft website. Does anyone know how I could do this? Thanks Liam
-
I want to distribute an application to people who may or may not have the .NET Framework installed. Currently, I have created a project that includes the application and the .NET Framework. The .NET framework is installed if it is currently not installed. However this leads to a large distribution file (I would like to email my application). As the .NET Framework is only needed to be installed once, any subsequent release containing the .NET Framework would be a waste. I would prefer to determine if the .NET Framework is installed. If not I would display a popup to tell the user to download the framework from the Microsoft website. Does anyone know how I could do this? Thanks Liam
You could examine the registry :- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
-
You could examine the registry :- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
-
What I am struggling with is how I get code to execute to determine if the .NET Framework exists. The code that I write will need the .NET Framework to run.
Windows Installer doesn't need .NET Framework. David Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy -
I want to distribute an application to people who may or may not have the .NET Framework installed. Currently, I have created a project that includes the application and the .NET Framework. The .NET framework is installed if it is currently not installed. However this leads to a large distribution file (I would like to email my application). As the .NET Framework is only needed to be installed once, any subsequent release containing the .NET Framework would be a waste. I would prefer to determine if the .NET Framework is installed. If not I would display a popup to tell the user to download the framework from the Microsoft website. Does anyone know how I could do this? Thanks Liam
LiamD wrote: Does anyone know how I could do this? Either in C++, or via your MSI generator. Christian Graus - Microsoft MVP - C++
-
LiamD wrote: Does anyone know how I could do this? Either in C++, or via your MSI generator. Christian Graus - Microsoft MVP - C++
-
Do you have a link describing how to doing this? I would have thought it a fairly common thing to do. Thanks, Liam
Which one ? Doing it in an MSI is in the help of whatever installer you use, and the C++ code just checks the registry key - here's some code: bool CRDCInstallerDlg::NeedsDotNet() { HKEY key; bool bRunInstall = true; ERRORMESSAGE("Checking for .NET", 1); if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\.NETFramework\\policy\\v1.1", 0, KEY_READ, &key)) { ERRORMESSAGE("Found registry key", 2); // Grossly simplified this test because Matt was reporting this was returning true when it should return false. bRunInstall = false; BYTE val[10]; DWORD len = 10; if (ERROR_SUCCESS == ::RegQueryValueEx(key, "4322", NULL, NULL, &val[0], &len)) { ERRORMESSAGE("Found item 4322", 2); // Yuck, yuck, yuck. I get an array of bytes out of the registry, but I need a char array for strcmp. char * pVal = (char*)&val[0]; if (0 == ::strcmp(pVal, "3706-4322")) { ERRORMESSAGE("Value is correct", 2); } } ::RegCloseKey(key); } return bRunInstall; } Christian Graus - Microsoft MVP - C++
-
I want to distribute an application to people who may or may not have the .NET Framework installed. Currently, I have created a project that includes the application and the .NET Framework. The .NET framework is installed if it is currently not installed. However this leads to a large distribution file (I would like to email my application). As the .NET Framework is only needed to be installed once, any subsequent release containing the .NET Framework would be a waste. I would prefer to determine if the .NET Framework is installed. If not I would display a popup to tell the user to download the framework from the Microsoft website. Does anyone know how I could do this? Thanks Liam
You should use Bootstrapper: http://msdn.microsoft.com/vstudio/downloads/tools/bootstrapper/
-
Windows Installer doesn't need .NET Framework. David Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidyIf you are using Windows Installer, it can detect and automatically install the framework if needed, (as David mentioned). You'll need the upgraded bootstrapper for it to work properly: http://support.microsoft.com/default.aspx?scid=kb;en-us;888469[^] If you are talking about something else, then you're probably talking about a non-.NET program to determine what exists: http://astebner.sts.winisp.net/Tools/detectFX.cpp[^]