Skip to content

Issues with RegFree COM manifest #3091

@AaronRobinsonMSFT

Description

@AaronRobinsonMSFT

The attribute in the assembly node is misspelled - should be manifestVersion.

XElement manifest = new XElement(ns + "assembly", new XAttribute("mainfestVersion", "1.0"));

The Guid should be inserted with braces (i.e. new XAttribute("clsid", guid.ToString("B")))

fileElement.Add(new XElement(ns + "comClass", new XAttribute("clsid", guid), new XAttribute("threadingModel", "Both")));

The manifest file is being written with a BOM. This must be removed as it will cause the Windows' SxS parser to consider the manifest invalid. The code could be updated as follows:

XDocument manifestDocument = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"), manifest);
var settings = new XmlWriterSettings();
settings.Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
using (XmlWriter manifestWriter = XmlWriter.Create(comManifestPath, settings))
{
    manifestDocument.WriteTo(manifestWriter);
}

cc @jkoritzinsky

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions