Results 1 to 6 of 6

Thread: [RESOLVED] Get Framework Version

  1. #1

    Thread Starter
    Frenzied Member toecutter's Avatar
    Join Date
    Apr 2006
    Location
    Brisbane, Australia
    Posts
    1,160

    Resolved [RESOLVED] Get Framework Version

    I am making a little Diagnostic Test app to check that certain folders and files exist.

    I would also like to list some system specs, i have almost all the ones i need except the currently installed framework version.

    I have search the My.Computer libraries and in the help but cannot get the framework version to display in a listbox.

    How to get the framework version into a string?

    regards
    toe

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Get Framework Version

    Do you mean the version that the current app is targeting or all versions installed, because a single system could have every version installed simultaneously? If it's the former then the Environment.Version property would be what you need. If it's the latter you would have to go to the Registry or the file system.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member toecutter's Avatar
    Join Date
    Apr 2006
    Location
    Brisbane, Australia
    Posts
    1,160

    Re: Get Framework Version

    Its the latter, after looking in file system it doesn't seem to be there so i think ill skip on the framework versions because after doing a search for it in the registry it looks far to complicated for me.

    regards
    toe

  4. #4
    Hyperactive Member Zeljko's Avatar
    Join Date
    Oct 2006
    Location
    Internet
    Posts
    441

    Re: Get Framework Version

    No it's not that complicated
    VB.Net Code:
    1. Dim installed_versions As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\NET Framework Setup\NDP")
    2. Dim version_names As String() = installed_versions.GetSubKeyNames()
    3. 'now you have them in array 'version_names' and you can do what you wanna...
    4. 'to get them in string...
    5. Dim NETversions As String = String.Join(" ; ", version_names)
    6.  
    7. 'NETversions string on my comp is "v1.1.4322 ; v2.0.50727 ; v3.0 ; v3.5"

    Ahh, and for net 1 is diferent reg key... search it on google if you need net 1
    1. If this post helped you, please Rate it = That's You, saying Thanks, to Me ...Left side of this post: [Rate this post]
    2. Mark this Thread Resolved if your question has been answered That's You, saying Thanks, to Group ...Menu on top of your original Post: [Thread Tools]>[Mark Thread Resolved]
    3.
    Check my site: www.er-ef.netCheck my snippets: Get installed .NET versionsRegex extractingJoin hierarchically nested Datatables in one flattened Datatable


  5. #5

    Thread Starter
    Frenzied Member toecutter's Avatar
    Join Date
    Apr 2006
    Location
    Brisbane, Australia
    Posts
    1,160

    Re: Get Framework Version

    Sweet, i only need to know if they have 2.0 at the present time

    Thanks heaps

  6. #6
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: [RESOLVED] Get Framework Version

    OK, shoot me. I know this thread is resolved, but I have something to add

    The File System way would be something similar to the following :
    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If Dir$("C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322", vbDirectory) <> "" Then
                MsgBox(".NET Framework 1.1")
    
            ElseIf Dir$("C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727", vbDirectory) <> "" Then
                MsgBox(".NET Framework 2.0")
    
            ElseIf Dir$("C:\WINDOWS\Microsoft.NET\Framework\v3.0", vbDirectory) <> "" Then
                MsgBox(".NET Framework 3.0")
    
            ElseIf Dir$("C:\WINDOWS\Microsoft.NET\Framework\v3.5", vbDirectory) <> "" Then
                MsgBox(".NET Framework 3.5")
    
            End If
        End Sub
    This code checks if these folders exist on the machine, for each folder that exists, it will pop up a messagebox. This is where all your .NET Framework(s)' stuff is stored

    I Hope it was useful
    VB.NET MVP 2008 - Present

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width