private string GetFullName(IAssemblyName asmName) { StringBuilder fullName = new StringBuilder(1024); int iLen = fullName.Capacity; COM.CheckHR(asmName.GetDisplayName(fullName, ref iLen, (int)AssemblyNameDisplayFlags.ALL)); return(fullName.ToString()); }
public AssemblyEnum(string sAsmName) { IAssemblyName asmName = null; if (sAsmName != null) //if no name specified all ssemblies will be returned { COM.CheckHR(CreateAssemblyNameObject(out asmName, sAsmName, CreateAssemblyNameObjectFlags.CANOF_PARSE_DISPLAY_NAME, IntPtr.Zero)); } COM.CheckHR(CreateAssemblyEnum(out m_assemblyEnum, IntPtr.Zero, asmName, AssemblyCacheFlags.GAC, IntPtr.Zero)); }
// If you use this, fusion will do the streaming & commit public static void InstallAssembly(string assemblyPath, InstallReference reference, AssemblyCommitFlags flags) { if (reference != null) { if (!InstallReferenceGuid.IsValidGuidScheme(reference.GuidScheme)) { throw new ArgumentException("Invalid argument( reference guid)."); } } IAssemblyCache asmCache = null; COM.CheckHR(CreateAssemblyCache(out asmCache, 0)); COM.CheckHR(asmCache.InstallAssembly((int)flags, assemblyPath, reference)); }
public string GetNextAssembly() { string retval = null; if (!m_done) { IAssemblyName asmName = null; COM.CheckHR(m_assemblyEnum.GetNextAssembly((IntPtr)0, out asmName, 0)); if (asmName != null) { retval = GetFullName(asmName); } m_done = (retval != null); } return(retval); }
public static string QueryAssemblyInfo(string assemblyName) { if (assemblyName == null) { throw new ArgumentException("Invalid argument (assemblyName)"); } AssemblyInfo aInfo = new AssemblyInfo(); aInfo.cchBuf = 1024; aInfo.currentAssemblyPath = "Path".PadLeft(aInfo.cchBuf); IAssemblyCache ac = null; COM.CheckHR(CreateAssemblyCache(out ac, 0)); COM.CheckHR(ac.QueryAssemblyInfo(0, assemblyName, ref aInfo)); return(aInfo.currentAssemblyPath); }
public static void UninstallAssembly(string assemblyName, InstallReference reference, out AssemblyCacheUninstallDisposition disp) { AssemblyCacheUninstallDisposition dispResult = AssemblyCacheUninstallDisposition.Uninstalled; if (reference != null) { if (!InstallReferenceGuid.IsValidGuidScheme(reference.GuidScheme)) { throw new ArgumentException("Invalid argument (reference guid)."); } } IAssemblyCache asmCache = null; COM.CheckHR(CreateAssemblyCache(out asmCache, 0)); COM.CheckHR(asmCache.UninstallAssembly(0, assemblyName, reference, out dispResult)); disp = dispResult; }