tools/VsIdeHostAdapter/TargetAddIn/Common/VSRegistry.cs
/// <summary>
/// Returns default version = max version without suffix.
/// </summary>
/// <param name="versions">If null, this is ignored.</param>
/// <returns></returns>
Returns default version = max version without suffix.
Returns default version = max version without suffix .
private static string GetVersionsHelper(out List<string> versions)
        {
            versions = new List<string>();
            string defaultVersion = null;
            Regex versionNoSuffixRegex = VsVersionComparer.VsVersionRegex;
            VsVersionComparer versionComparer = new VsVersionComparer();
            using (RegistryKey vsKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio"))
            {
                foreach (string versionKeyName in vsKey.GetSubKeyNames())
                {
                    using (RegistryKey versionKey = vsKey.OpenSubKey(versionKeyName))
                    {
                        if (versionKey.GetValue("InstallDir") == null)
                        {
                            continue;
                        }
                        versions.Add(versionKeyName);
                    }
                    if (RegistrySettings.VsRegistryRoot.EndsWith(versionKeyName))
                    {
                        defaultVersion = versionKeyName;
                    }
                }
            }
            return defaultVersion;
        }
private static string GetVersionsHelper ( out List < string > versions ) { versions = new List < string > ( ) ; string defaultVersion = null ; Regex versionNoSuffixRegex = VsVersionComparer . VsVersionRegex ; VsVersionComparer versionComparer = new VsVersionComparer ( ) ; using ( RegistryKey vsKey = Registry . LocalMachine . OpenSubKey ( @"SOFTWARE\Microsoft\VisualStudio" ) ) { foreach ( string versionKeyName in vsKey . GetSubKeyNames ( ) ) { using ( RegistryKey versionKey = vsKey . OpenSubKey ( versionKeyName ) ) { if ( versionKey . GetValue ( " " ) == null ) { continue ; } versions . Add ( versionKeyName ) ; } if ( RegistrySettings . VsRegistryRoot . EndsWith ( versionKeyName ) ) { defaultVersion = versionKeyName ; } } } return defaultVersion ; }
Returns default version = max version without suffix.
Returns default version = max version without suffix .
// Default is the current version without suffix, like 8.0. // Note that the version does not have to be numeric only: can be 8.0Exp. // If there's no InstallDir subkey we skip this key.
None
List<string>
out
versions
If null, this is ignored.
If null this is ignored .