Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Determine if .NET Framework is installed

Determine if .NET Framework is installed

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdotnetquestionannouncement
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LiamD
    wrote on last edited by
    #1

    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

    N C A 3 Replies Last reply
    0
    • L LiamD

      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

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      You could examine the registry :- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform

      L 1 Reply Last reply
      0
      • N Nish Nishant

        You could examine the registry :- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform

        L Offline
        L Offline
        LiamD
        wrote on last edited by
        #3

        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.

        D 1 Reply Last reply
        0
        • L LiamD

          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.

          D Offline
          D Offline
          DavidNohejl
          wrote on last edited by
          #4

          Windows Installer doesn't need .NET Framework. David Never forget: "Stay kul and happy" (I.A.)
          David's thoughts / dnhsoftware.org / MyHTMLTidy

          J 1 Reply Last reply
          0
          • L LiamD

            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

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            LiamD wrote: Does anyone know how I could do this? Either in C++, or via your MSI generator. Christian Graus - Microsoft MVP - C++

            L 1 Reply Last reply
            0
            • C Christian Graus

              LiamD wrote: Does anyone know how I could do this? Either in C++, or via your MSI generator. Christian Graus - Microsoft MVP - C++

              L Offline
              L Offline
              LiamD
              wrote on last edited by
              #6

              Do you have a link describing how to doing this? I would have thought it a fairly common thing to do. Thanks, Liam

              C 1 Reply Last reply
              0
              • L LiamD

                Do you have a link describing how to doing this? I would have thought it a fairly common thing to do. Thanks, Liam

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                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++

                1 Reply Last reply
                0
                • L LiamD

                  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

                  A Offline
                  A Offline
                  asm123
                  wrote on last edited by
                  #8

                  You should use Bootstrapper: http://msdn.microsoft.com/vstudio/downloads/tools/bootstrapper/

                  1 Reply Last reply
                  0
                  • D DavidNohejl

                    Windows Installer doesn't need .NET Framework. David Never forget: "Stay kul and happy" (I.A.)
                    David's thoughts / dnhsoftware.org / MyHTMLTidy

                    J Offline
                    J Offline
                    John Arlen1
                    wrote on last edited by
                    #9

                    If 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[^]

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups