Search code examples
wixdigital-signaturesetup.exe

WiX creation of setup.exe wxs file


I have built program and it is stored in build_artifacts folder. This is the wxs script I have so far:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="BIGProject" Language="1033" Version="1.0.0.0" Manufacturer="Siemens Healthineers AG" UpgradeCode="{65413516516}">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of BIGProject is already installed." />

        <MediaTemplate EmbedCab="yes" />

        <Feature Id="MainExecutable" Title="BIG Project" Level="1">
            <ComponentRef Id="MainExecutable" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="BIGProject" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="MainComponentGroup">
            <Component Id="MainExecutable" Guid="65413517894" Directory="INSTALLFOLDER">
                <File Source="build_artifacts\" KeyPath="yes" />
            </Component>
        </ComponentGroup>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="SigningGroup">
            <Component Id="SignBIGProjectSetup" Guid="PUT-GUID-HERE">
                <File Source="path\to\my\signed\BIGProjectSetup.exe" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

The only working part which was not producing error was the same script without this part

    <Fragment>
        <ComponentGroup Id="SigningGroup">
            <Component Id="SignBIGProjectSetup" Guid="PUT-GUID-HERE">
                <File Source="path\to\my\signed\BIGProjectSetup.exe" />
            </Component>
        </ComponentGroup>
    </Fragment>

The result I had was BIGProjectSetup.exe, but after executing this exe it said "This app cannot be executed on this PC" or something like that. I thought it was because of a lack of Sign.

What should I do to make it work?


Solution

  • The output for a Product should be a Windows Installer database, aka: MSI file. Change the output extension from .exe to .msi and I expect it will work better.