public GetAssemblyFileName ( string assemblyName ) : string | ||
assemblyName | string | The assembly name of the assembly of which the file name should be returned. |
return | string |
protected string GetPrimaryInteropAssembly() { string typeLibVersionKey = string.Format(CultureInfo.InvariantCulture, @"TYPELIB\{0}\{1}", TypeLibGuid, TypeLibVersion); string assemblyFile = null; using (RegistryKey registryKey = Registry.ClassesRoot.OpenSubKey(typeLibVersionKey)) { if (registryKey != null && registryKey.GetValue("PrimaryInteropAssemblyName") != null) { string primaryInteropAssemblyName = (string)registryKey.GetValue("PrimaryInteropAssemblyName"); try { // get filename of primary interop assembly assemblyFile = ReferencesResolver.GetAssemblyFileName( primaryInteropAssemblyName); } catch (Exception ex) { // only have build fail if we're actually dealing with a // reference to a primary interop assembly // // certain tools (such as Office) register the name of // the primary interop assembly of the typelib, but the // actual primary interop assembly is not always installed if (WrapperTool == "primary") { throw new BuildException(string.Format(CultureInfo.InvariantCulture, "Primary Interop Assembly \"{0}\", referenced by project" + " \"{1}\", could not be loaded.", primaryInteropAssemblyName, Parent.Name), Location.UnknownLocation, ex); } } } } return(assemblyFile); }