Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W0W6432Node / COM Registration #621

Closed
MarkHaroldson opened this issue Apr 3, 2019 · 5 comments
Closed

W0W6432Node / COM Registration #621

MarkHaroldson opened this issue Apr 3, 2019 · 5 comments

Comments

@MarkHaroldson
Copy link

I have 100% 64 bit application. As part of the installation script I am registering a single COM object by writing the values directly to HKCR\CLSID{XXXXXX}...

The problem is that on installation the values are being writen to the WIN6432 node.

The projects platform is set to X64 and all of the component nodes are set to Win64-"yes"

Here is a snippet of the generated script. Any ideas on what to look for in the MSI spew log? From what I can tell it is trying to write to the 64 bit CLSID.

Thanks!

    <Component Id="Registry.9" Guid="5f7e7fcf-8150-4b64-8610-eaecbe65e5ff" Win64="yes">
      <RegistryKey Root="HKCR" Key="CLSID\{E6D572FE-8E55-4A99-AB31-3C1AF6A4BC35}" Action="createAndRemoveOnUninstall" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
        <RegistryValue Id="RegValue.1" Type="string" KeyPath="yes" Value="THE NAME OF THE OBJECT" />
      </RegistryKey>

      <CreateFolder />
    </Component>
@oleg-shilo
Copy link
Owner

Yeah, when it comes to registry and x64 MSI is a mess.

I just tested your use-case with this code:

var project =
    new Project("MyProduct",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            new File("readme.txt")),
        new RegValue(RegistryHive.LocalMachine, @"Software\My Company\My Product", "LICENSE_KEY_64", "01020304")
        {
            Win64 = true
        });

project.Platform = Platform.x64;
project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
project.UI = WUI.WixUI_ProgressOnly;
project.PreserveTempFiles = true;

project.BuildMsi();

And it seems to work:
image

@MarkHaroldson
Copy link
Author

MarkHaroldson commented Apr 4, 2019 via email

@oleg-shilo
Copy link
Owner

Hi Mark,

Will a future version inclide the “Class” and “Prog” id types to be added to a “File” element?

Yes, absolutely. This is exactly how I want to see WixSharp growing in features...

It simply cannot cover the all spectrum of all MSI/WiX features that are inconsistent, unpredictable and often being re-implemented (improved) or even deprecated.

I always wanted WixSharp cover let's say 80% of all WiX functionality (~99% of most common use-cases). Thus in case of WixSharp running out of steam users can use XML injection or IGenericEntity classes to bridge the gaps. And if they shared their work around (like you did) it becomes a mainstream feature of WixSharp.

Thank you. Will implement it in a few days or so and release a HotFix.

@oleg-shilo
Copy link
Owner

oleg-shilo commented Apr 8, 2019

You don't have to wait until the feature is avilable in the next release. You can just repeat it in your codebase by defining the ComRegistration class:

Your msi project definition:

new File(@"Files\Bin\MyApp.exe",
    new ComRegistration
    {
        Id = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"),
        Description = "MY DESCRIPTION",
        ThreadingModel = "apartment",
        Context = "InprocServer32",
        ProgIds = new[]
        {
            new ProgId
            {
                Id = "PROG.ID.1",
                Description ="Version independent ProgID ",
                ProgIds = new[]
                {
                    new ProgId
                    {
                        Id = "prog.id",
                        Description="some description"
                    }
                }
            }
        }
    },
   . . . 

And the ComRegistration class:

public class ProgId
{
    [WixSharp.Xml]
    public string Id;

    [WixSharp.Xml]
    public bool? Advertise;

    [WixSharp.Xml]
    public string Description;

    [WixSharp.Xml]
    public string Icon;

    [WixSharp.Xml]
    public string IconIndex;

    [WixSharp.Xml]
    public string NoOpen;

    public ProgId[] ProgIds;

    public XElement ToXElement()
    {
        var root = new XElement("ProgId");
        root.Add(this.MapToXmlAttributes());
        ProgIds?.ForEach(progIdChild => root.Add(progIdChild.ToXElement()));

        return root;
    }
}

public class ComRegistration : WixEntity, IGenericEntity
{
    [WixSharp.Xml]
    public new Guid Id;

    [WixSharp.Xml]
    public bool? Advertise;

    [WixSharp.Xml]
    public string Context = "InprocServer32";

    [WixSharp.Xml]
    public string ThreadingModel;

    [WixSharp.Xml]
    public string Description;

    public ProgId[] ProgIds;

    public void Process(ProcessingContext context)
    {
        XElement element = this.ToXElement("Class");
        ProgIds?.ForEach(progIdChild => element.Add(progIdChild.ToXElement()));

        context.XParent.Add(element);
    }
}

oleg-shilo pushed a commit that referenced this issue Apr 9, 2019
- Added COM registration support
@MarkHaroldson
Copy link
Author

MarkHaroldson commented Apr 10, 2019 via email

oleg-shilo pushed a commit that referenced this issue Apr 10, 2019
* Added COM registration support
* Issue #621: W0W6432Node/COM Registration
* Issue 608: Create Shortcut on Desktop to dotnet.exe
* Addressed candle warning on `AutoElements.UACWarning = ""`
* Completely removed all traces of `SetEnvVar.dll`. Part of #620 fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants