Skip to content

Instantly share code, notes, and snippets.

@slmcmahon
Created November 29, 2010 21:27
Show Gist options
  • Save slmcmahon/720653 to your computer and use it in GitHub Desktop.
Save slmcmahon/720653 to your computer and use it in GitHub Desktop.
returns a comma delimited list of available .net frameworks
// 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