public void Install(string fileName, IntPtr pRef)
        {
            IAssemblyCache cache;

            ComUtil.ComCheck(Fusion.CreateAssemblyCache(out cache, 0));

            ComUtil.ComCheck(cache.InstallAssembly(Fusion.ASM_INSTALL_FLAG.IASSEMBLYCACHE_INSTALL_FLAG_REFRESH, fileName, pRef));
        }
        public UninstallDisposition Uninstall(string assemblyName, IntPtr pRef)
        {
            IAssemblyCache cache;

            ComUtil.ComCheck(Fusion.CreateAssemblyCache(out cache, 0));

            ASM_UNINSTALL_DISPOSITION disposition;

            ComUtil.ComCheck(cache.UninstallAssembly(0, assemblyName, pRef, out disposition));

            return((UninstallDisposition)disposition);
        }
        public bool Check(string assemblyName, out string msg)
        {
            IAssemblyCache cache;

            ComUtil.ComCheck(Fusion.CreateAssemblyCache(out cache, 0));

            ASSEMBLY_INFO info = new ASSEMBLY_INFO();

            info.cbAssemblyInfo            = (uint)Marshal.SizeOf(info);
            info.cchBuf                    = 0;
            info.pszCurrentAssemblyPathBuf = IntPtr.Zero;

            int hr = cache.QueryAssemblyInfo(QUERYASMINFO_FLAG.QUERYASMINFO_FLAG_VALIDATE, assemblyName, ref info);

            if (hr == ComUtil.ERROR_INSUFFICIENT_BUFFER && info.cchBuf > 0)
            {
                info.pszCurrentAssemblyPathBuf = Marshal.AllocCoTaskMem((int)info.cchBuf * 2);
                try
                {
                    ComUtil.ComCheck(cache.QueryAssemblyInfo(
                                         QUERYASMINFO_FLAG.QUERYASMINFO_FLAG_VALIDATE | QUERYASMINFO_FLAG.QUERYASMINFO_FLAG_GETSIZE,
                                         assemblyName, ref info));

                    string path = Marshal.PtrToStringUni(info.pszCurrentAssemblyPathBuf);

                    msg = string.Format("{0} ({1} KB) @ {2}", assemblyName, info.uliAssemblySizeInKB, path);
                }
                finally
                {
                    Marshal.FreeCoTaskMem(info.pszCurrentAssemblyPathBuf);
                }

                return(true);
            }
            else
            {
                try { Marshal.ThrowExceptionForHR(hr); msg = ""; }
                catch (Exception e) { msg = e.Message; }

                return(false);
            }
        }