Microsoft.VisualStudio.Project.ComReferenceNode.SetInstalledFilePath C# (CSharp) Method

SetInstalledFilePath() protected method

Verify that the TypeLib is registered and set the installed file path of the com reference.
protected SetInstalledFilePath ( ) : void
return void
        protected virtual void SetInstalledFilePath()
        {
            string registryPath = string.Format(CultureInfo.InvariantCulture, @"TYPELIB\{0:B}\{1:x}.{2:x}", this.typeGuid, this.MajorVersionNumber, this.MinorVersionNumber);
            using(RegistryKey typeLib = Registry.ClassesRoot.OpenSubKey(registryPath))
            {
                if(typeLib != null)
                {
                    // Check if we need to set the name for this type.
                    if(string.IsNullOrEmpty(this.typeName))
                    {
                        this.typeName = typeLib.GetValue(string.Empty) as string;
                    }
                    // Now get the path to the file that contains this type library.
                    using(RegistryKey installKey = typeLib.OpenSubKey(string.Format(CultureInfo.InvariantCulture, @"{0}\win32", this.Lcid)))
                    {
                        this.installedFilePath = installKey.GetValue(String.Empty) as String;
                    }
                }
            }
        }