Example #1
0
        public static void GenerateGACDetectionManifest(ReferenceIdentity refId, string outputManifest)
        {
            XmlDocument document = ManifestGenerator.CloneAssemblyTemplate();

            if (ManifestGenerator.GACDetectionTempManifestAsmId == null)
            {
                Interlocked.CompareExchange(ref ManifestGenerator.GACDetectionTempManifestAsmId, (object)new DefinitionIdentity("GACDetectionTempManifest, version=1.0.0.0, type=win32"), (object)null);
            }
            ManifestGenerator.InjectIdentityXml(document, (DefinitionIdentity)ManifestGenerator.GACDetectionTempManifestAsmId);
            ManifestGenerator.AddDependencies(document, new DependentAssembly[1]
            {
                new DependentAssembly(refId)
            });
            using (FileStream fileStream = System.IO.File.Open(outputManifest, FileMode.CreateNew, FileAccess.Write))
                document.Save((Stream)fileStream);
        }
Example #2
0
        public static DefinitionIdentity GenerateManifest(ReferenceIdentity suggestedReferenceIdentity, AssemblyManifest manifest, string outputManifest)
        {
            DefinitionIdentity asmId = manifest.Identity;

            if (manifest.RawXmlBytes != null)
            {
                using (FileStream fileStream = System.IO.File.Open(outputManifest, FileMode.CreateNew, FileAccess.Write))
                    fileStream.Write(manifest.RawXmlBytes, 0, manifest.RawXmlBytes.Length);
            }
            else
            {
                XmlDocument document = ManifestGenerator.CloneAssemblyTemplate();
                asmId = new DefinitionIdentity(suggestedReferenceIdentity);
                ManifestGenerator.InjectIdentityXml(document, asmId);
                ManifestGenerator.AddFiles(document, manifest.Files);
                ManifestGenerator.AddDependencies(document, manifest.DependentAssemblies);
                using (FileStream fileStream = System.IO.File.Open(outputManifest, FileMode.CreateNew, FileAccess.Write))
                    document.Save((Stream)fileStream);
            }
            return(asmId);
        }