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. C#
  4. How to detect .net Framework 3.5 is installed or available

How to detect .net Framework 3.5 is installed or available

Scheduled Pinned Locked Moved C#
csharpdotnettutorialquestion
5 Posts 4 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.
  • S Offline
    S Offline
    Seraph_summer
    wrote on last edited by
    #1

    It is known that some functions are supported by .net Framework 3.5. therefore, how to detect automatically that .net framework 3.5 is already installed on the current computer? in order to give the message to the user when the user try to use some functions only supported by .net framework 3.5? thanks.

    P U 2 Replies Last reply
    0
    • S Seraph_summer

      It is known that some functions are supported by .net Framework 3.5. therefore, how to detect automatically that .net framework 3.5 is already installed on the current computer? in order to give the message to the user when the user try to use some functions only supported by .net framework 3.5? thanks.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      That doesn't give the user a good experience. I'd hate to have an application tell me "You can't use feature x because you don't have MyWizzyFramework 3.91 installed." Put the .NET Framework as a required resource in your setup project so that it is installed up front (if they don't already have it installed).

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      My blog | My articles | MoXAML PowerToys

      S 1 Reply Last reply
      0
      • P Pete OHanlon

        That doesn't give the user a good experience. I'd hate to have an application tell me "You can't use feature x because you don't have MyWizzyFramework 3.91 installed." Put the .NET Framework as a required resource in your setup project so that it is installed up front (if they don't already have it installed).

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        My blog | My articles | MoXAML PowerToys

        S Offline
        S Offline
        Seraph_summer
        wrote on last edited by
        #3

        thanks, you are right, I agree with you completely. but I provide two choices to the user with similar functions, but the better one is only supported by .net Framework 3.5. I just want my application more flexible to the user, he can select which function he want to use.

        1 Reply Last reply
        0
        • S Seraph_summer

          It is known that some functions are supported by .net Framework 3.5. therefore, how to detect automatically that .net framework 3.5 is already installed on the current computer? in order to give the message to the user when the user try to use some functions only supported by .net framework 3.5? thanks.

          U Offline
          U Offline
          User 4467139
          wrote on last edited by
          #4

          The following code will give you the list of available versions. const string regLocation = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP"; RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(regLocation); RegistryKey tempKey; string[] SubKeyNames = masterKey.GetSubKeyNames(); for( int i = 0 ; i < SubKeyNames.Length ; i++ ) {tempKey = Registry.LocalMachine.OpenSubKey(regLocation + "\\" + SubKeyNames[ i ]); MessageBox.Show(SubKeyNames[ i ]); MessageBox.Show("\tVersion = {0}", tempKey.GetValue("Version").ToString()); } Or you can check the currently user version using the following. MessageBox.Show(Environment.Version.ToString());

          J 1 Reply Last reply
          0
          • U User 4467139

            The following code will give you the list of available versions. const string regLocation = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP"; RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(regLocation); RegistryKey tempKey; string[] SubKeyNames = masterKey.GetSubKeyNames(); for( int i = 0 ; i < SubKeyNames.Length ; i++ ) {tempKey = Registry.LocalMachine.OpenSubKey(regLocation + "\\" + SubKeyNames[ i ]); MessageBox.Show(SubKeyNames[ i ]); MessageBox.Show("\tVersion = {0}", tempKey.GetValue("Version").ToString()); } Or you can check the currently user version using the following. MessageBox.Show(Environment.Version.ToString());

            J Offline
            J Offline
            Jon Rista
            wrote on last edited by
            #5

            Environment.Version always returns the CLR version, not the current framework version. For .NET 2.0, 3.0, and 3.5, Environment.Version returns 2.0.50727.3053, since 3.0 and 3.5 are just API extensions to 2.0.

            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