[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
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.
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
Re: Get Framework Version
No it's not that complicated :)
VB.Net Code:
Dim installed_versions As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\NET Framework Setup\NDP")
Dim version_names As String() = installed_versions.GetSubKeyNames()
'now you have them in array 'version_names' and you can do what you wanna...
'to get them in string...
Dim NETversions As String = String.Join(" ; ", version_names)
'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
Re: Get Framework Version
Sweet, i only need to know if they have 2.0 at the present time
Thanks heaps
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 :)