Created
November 29, 2010 21:27
-
-
Save slmcmahon/720653 to your computer and use it in GitHub Desktop.
returns a comma delimited list of available .net frameworks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// need this to be able to run in .net 2.0. The result of this is to be sent up | |
// to the server by the client so that we can determine what versions of the | |
// .net framework that our users have installed | |
private string GetAvailableFrameworks() | |
{ | |
string frameworkRegistryPath = @"Software\Microsoft\.netframework"; | |
List<string> versions = new List<string>(); | |
RegistryKey key = Registry.LocalMachine.OpenSubKey(frameworkRegistryPath); | |
if (key == null) | |
{ | |
return String.Format("{0} not found.", frameworkRegistryPath); | |
} | |
foreach (var subkey in key.GetSubKeyNames()) | |
{ | |
if (subkey.StartsWith("v")) | |
{ | |
versions.Add(subkey.Substring(1)); | |
} | |
} | |
return String.Join(",", versions.ToArray()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment