[wix-users] Using the same installer for manual and administrative installs, allowing custom installdir overwrite.

Rob Mensching rob at firegiant.com
Thu Feb 4 11:26:19 PST 2021

Note: Admin installs (msiexec /a) are used to create a layout of the package on a network share that is then Installed (msiexec /i) on all the computers where the product is to be used.

It sounds like you're using admin installs in a very "creative" (aka: completely unintended) way.

Just be aware of that as you try to move forward.

Short replies here. Complete answers here: https://www.firegiant.com/services/

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Stefan Strijker via wix-users
Sent: Thursday, February 4, 2021 6:18 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Stefan Strijker <s.strijker at voortman.net>
Subject: Re: [wix-users] Using the same installer for manual and administrative installs, allowing custom installdir overwrite.

Hello and thanks for the quick response,

Using /i instead of /a does indeed give the result that we like to see when installing from msiexec (allowing us to overwrite INSTALLDIR), however this causes 2 other issues.
1. The installation now requires admin privileges 2. The installation will now block any further parallel installations elsewhere on the same machine.

Nr. 2 is the main concern here, due to the need for the automated install being rooted in our automated testing framework which installs the required software + modules and then runs certain tests on it. With administrative installs we can run multiple instances in parralel where with normal installs (/i) a 2nd parralel instalation will result in the 'Another version of this product is already installed.  Installation of this version cannot continue.  To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel` Error.
Administrative allowed us to install the required DLL's into multiple different workspaces without having to make sure previous installed workspaces were cleaned up. 

Is there any other way to solve the original problem without having to move away from administrative installs ?


-----Original Message-----a
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Andreas Orzyszek via wix-users
Sent: Wednesday, February 3, 2021 4:52 PM
To: wix-users at lists.wixtoolset.org
Cc: Andreas Orzyszek <andreas.orzyszek at gmail.com>
Subject: Re: [wix-users] Using the same installer for manual and administrative installs, allowing custom installdir overwrite.



in this case the property that must be set from the commandline should be INSTALLDIR=<FolderPath>

But you are using the /a option which is administrative install and this is maybe not what you want.

Try msiexec <msiFilePath> /quiet /norestart /l*v <LogFilePath> INSTALLDIR=<FolderPath>

And try it with your commandshell first before from the powershell script. You can then check the log for the INSTALLDIR Property.

Am 03.02.2021 um 15:06 schrieb Stefan Strijker via wix-users:
> Hello,
> I have got some software that is distributed trough an MSI installer. 
> Everything seems to be working out fine as long as this installer is 
> manually run. For testing purposes however, I am trying to run the 
> same installer inside of our testing framework during setup, using 
> msiexec
> ```
> string targetDirectory = @"C:\git\00_DATA\; // For testing purposes 
> string arguments = "/qn /a \"" + msiFile + "\" TARGETDIR=\"" + 
> targetDirectory + "\" /l*V \"" + logLocation + "\""; 
> Directory.CreateDirectory(targetDirectory);
> Process process = Process.Start("msiexec", arguments); ```
> The MSI installer looks roughly like this:
> ```
> Product Id="*" Name="$(var.productName)" Language="1033" Version="$(var.productVersion)" Manufacturer="$(var.companyName)" UpgradeCode="$(var.productUpgradeCode)">
>      <!--package requires installer 400 (4.0. included from vista and up). install on machine scope-->
>      <Package Id="*" InstallerVersion="400" Compressed="yes" 
> InstallScope="perMachine" />
>      <!--Require administartor access rights-->
>      <Condition Message="You need to be an administrator to install $(var.productName).">
>        Privileged
>      </Condition>
>      <!--Check if this is an update-->
>      <MajorUpgrade AllowSameVersionUpgrades="yes" Disallow="yes" 
> DowngradeErrorMessage="A later version of the package is already 
> installed. Setup will now exit." DisallowUpgradeErrorMessage="Please 
> uninstall the  package using the control panel before installing a 
> newer version."/>
>      <!--Enforce all resources to be dumped into a cab file, enabled very light compression to save on speed but take easy shortcuts to make it a little smaller-->
>     <Media Id="1" Cabinet="data.cab" EmbedCab="yes" 
> CompressionLevel="mszip"/>
>      <!--Directory structure for installation, root-->
>      <Directory Id="TARGETDIR" Name="SourceDir">
>        <Directory Id="$(var.programFolder)">
>          <Directory Id="$(var.companyName)" Name="$(var.companyName)">
>            <Directory Id="INSTALLDIR" Name="$(var.ProductName)">
>              <!--Add installation directory as component. This way it will clean up all of the module in one go, instead of having to set a delete on every single file-->
>              <Component Id="INSTALLDIR_comp" Guid="920C1EF1-DFAA-43FB-84A6-FA50EC0AD661">
>                <CreateFolder>
>                  <Permission User="Users" GenericAll="yes" />
>                </CreateFolder>
>              </Component>
>            </Directory>
>          </Directory>
>        </Directory>
>      </Directory>
>      <!--Feaatures are 'what to install'. Only support a full install for now-->
>      <Feature Id="Complete" Title="$(var.productName)" Description="Full installation" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
>        <ComponentRef Id="INSTALLDIR_comp"/>
>        <ComponentRef Id="Product_Component"/>
>        <ComponentGroupRef Id="INSTALLDIR_comp"/>
>      </Feature>
>      <!--Set pictures, banners ect for screen-->
>      <WixVariable Id="WixUIBannerBmp" Value="banner.bmp" />
>      <WixVariable Id="WixUIDialogBmp" Value="dialog.bmp"/>
>      <!--Set programs and installer icon-->
>      <Icon Id="installer_icon" SourceFile="installer.ico"/>
>      <Property Id="ARPPRODUCTICON" Value="installer_icon"/>
>      <!--Property with installation folder location (from and to ui)-->
>      <Property Id="WIXUI_INSTALLDIR">INSTALLDIR</Property>
>      <!-- Variable with the location of the license -->
>      <WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
>      <!--UI-->
>      <UI>
>        <UIRef Id="WixUI_InstallDir" />
>        <UIRef Id="WixUI_ErrorProgressText" />
>      </UI>
>    </Product>
> </Wix>
> ```
> When manually ran the installdir dialog allows me to overwrite the 
> INSTALDIR just fine, providing the programfiles/<companyname>/<productname> location as a default.
> When ran trough msiexec however, INSTALLDIR doesnt seem to be working 
> as a valid parameter, causing me to not be able to overwrite it 
> causing it to always end up in the default location: 
> programfiles/<companyname>/<productname>
> .
> As an alternative I have received the suggestion to replace the <Directory> bit with the following:
> ```
> <!-- Set the installdir after the launchconditions, we have to this 
> otherwise the installdir has subdirs when doing an administrative 
> install (no launch conditions event in administrative install).--> 
> <SetProperty Id="INSTALLDIR" After="LaunchConditions" 
> Value="[$(var.programFolder)]\$(var.companyName)\$(var.productName)"/>
> <!--Directory structure for installation, root--> <Directory 
> Id="TARGETDIR" Name="SourceDir"> <Directory Id="$(var.programFolder)"> 
> <Directory Id="INSTALLDIR"> ```
> This fixes the issues I have with msiexec, allowing me to specify the location to install with the TARGETDIR parameter. However, the wix_UI bit no longer seems to overwrite anything in manual instalation with this change.
> After having struggled with this for a full day trying out different 
> solutions (adding custom parameter to overwrite installdir in a 
> customaction and other attempts), I figured I should go to the great 
> internet and ask for help :)
> Can anyone here point me in the right direction and give me some guidance ? Or even provide a working example/snippet that allows me to use 1 and the same installer for manual use + msiexec usage, while still being able to provide a default location in case nothing is specified in parameters.
> Thanks,
> Stefan Strijker
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> http://www.firegiant.com/

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list