[wix-users] The prerequisites fail to install

Tigran Galoyan tigran.galoyan at gmail.com
Fri Apr 8 14:38:41 PDT 2022


Hi Community,

In my installers solution I have a couple of bootstrapper projects which
all depend on almost the same set of prerequisite packages. Not to have a
Prerequisites folder for each project and have all the packages duplicated
in every project Prerequisites folder I moved the Prerequisites folders to
be located at one place only at the root level next to my solution file:

*assume my C:\Installers folder has the following structure*

[Installers]
    [Installer1]
        [BootstrapperProject1]
            bootstrapper_proj1.wixproj
        [Installer1Project]
             installer1_proj.wixproj
        [Installer1CustomActions]
             installer1_custactions.csproj
    [Installer2]
        [BootstrapperProject2]
            bootstrapper_proj2.wixproj
        [Installer2Project]
             installer2_proj.wixproj
        [Installer2CustomActions]
             installer2_custactions.csproj
    [Prerequisites]
        package1.exe
        package2.exe
    Installers.sln

So my bootstrapper projects in their <Bundle /> have a definition:

    <WixVariable Id="PrerequisitesDirectory"
Value="$(SolutionDir)Prerequisites\" />

and the <ExePackage>-s have the SourceFile defined to be based on that path

    SourceFile="!(wix.PrerequisitesDirectory)package1.exe"

However, when I build the solution on our build server, over there the
source code is on E:\ drive (E:\Installers\...) and when I get the
setup.exe to install on a target machine it fails to install the
prerequisites because it tries to create a local cache using the absolute
path from the source and since on the target machine we don't have an E:\
drive then it cannot copy the prerequisites and run them. If I build on my
local machine assuming the code is on C:\Installers\ then everything is
fine when we install the setup.exe on a target machine, it basically
creates the C:\Installers\Prerequisites\ folder and copies the packages
under. That way it works.

We cannot change the E:\ drive structure on the builder servers, so I had
to move the Prerequisites folder and have its duplicated copies under each
bootstrapper project folder and in my bootstrapper projects in their
<Bundle /> have changed the definition to:

    <WixVariable Id="PrerequisitesDirectory" Value="Prerequisites\" />

This way it will work and during the setup install on a target machine the
prerequisite packages are copied under the "ProgramData\Package
Cache\[GUID-FOLDER]\" and installed from there with no issues.

To avoid the duplication of source packages I thought I can use relative
paths when defining the prerequisites directory and I moved it back to
solution level as it was before and modified the Bundles to have the
variable definition this way:

    <WixVariable Id="PrerequisitesDirectory" Value="..\..\Prerequisites\" />

The setup.exe again fails to install the packages since this time the
Prerequisites cache folder is being created under C:\ProgramData\ directly
since 2 levels up from "ProgramData\Package Cache\[GUID-FOLDER]\" ends up
under ProgramData and Windows is not happy and won't install the packages
from that folder (security reasons I believe).

Can you please advise, how I can avoid having duplicate copies of
Prerequisites under each bootstrapper folder, to have it at one location
(preferably at the solution level) and still dictate the Windows Installer
to put my Prerequisites under "C:\ProgramData\Package
Cache\[GUID-FOLDER]\"???

Thanks in advance and your help is much appreciated.

Best,
Tigran


More information about the wix-users mailing list