public static IAssemblyCache GetIAssemblyCache(String assemblyName, FUSION_INSTALL_REFERENCE reference)
        {
            if (reference != null)
            {
                if (!InstallReferenceGuid.IsValidUninstallGuidScheme(reference.GuidScheme))
                {
                    throw new ArgumentException("Invalid reference guid.", "guid");
                }
            }

            //  Create an assembly cache objet.
            IAssemblyCache ac = null;
            int            hr = FusionImports.CreateAssemblyCache(out ac, 0);

            if (hr < 0)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            return(ac);

            //////////  Uninstall the assembly.
            ////////hr = ac.UninstallAssembly(0, assemblyName, reference, out disp);
            ////////if (hr < 0)
            ////////    Marshal.ThrowExceptionForHR(hr);
        }
        public static void InstallAssembly(String assemblyPath, FUSION_INSTALL_REFERENCE reference, AssemblyCommitFlags flags)
        {
            if (reference != null)
            {
                if (!InstallReferenceGuid.IsValidInstallGuidScheme(reference.GuidScheme))
                {
                    throw new ArgumentException("Invalid reference guid.", "guid");
                }
            }

            IAssemblyCache ac = null;

            int hr = 0;

            hr = FusionImports.CreateAssemblyCache(out ac, 0);
            if (hr >= 0)
            {
                hr = ac.InstallAssembly((int)flags, assemblyPath, reference);
            }

            if (hr < 0)
            {
                if (hr == -2146234300 /*0x80131044*/)
                {
                    throw new AssemblyMustBeStronglyNamedException();
                }
                else
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }
        }