I'm having a problem with a multi-instance installation I've created, 
specifically using the msiexec /qn and /x options. I'm hoping someone can give 
me some insight on the root cause.

Background

The installer I've created uses instance transforms and works fine when 
installed using msiexec with the /i option to perform the installation. For 
example, the following works:

msiexec /i product.msi COUNTRY=US ENVIRONMENT=PROD

Note that the COUNTRY and ENVIRONMENT properties are used to calculate the 
specific transform to use (I've included the relevant WiX code below). I could 
have also used the following instead:

msiexec /i product.msi TRANSFORMS=":US_PROD;"

The product shows up with the right instance-specfic description in Programs 
and Features (I'm using Windows 2008 R2) and can be properly uninstalled from 
there.

Platform    = Windows Server 2008 R2
VersionMsi  = 5.00
WiX Version = 3.6 Beta

Problem

The problem occurs when I specify the /qn (no user interface) option during 
install. Although the correct files and registry entries are created i.e. the 
right transform is used for execution, the product is now uninstallable. The 
following is an example install command:

msiexec /qn /i product.msi COUNTRY=US ENVIRONMENT=PROD

I've also tried the following with no luck:

msiexec /qn /i product.msi TRANSFORMS=":US_PROD;"

Programs and Features shows the wrong description (not instance-specific) and 
trying to uninstall gives the error "This action is only valid for products 
that are installed"

Another problem is that uninstall isn't possible using the /x option unless the 
product was installed *without* using the /qn option and also that the 
TRANSFORMS property is specified during uninstall. For example, the following 
works:

msiexec /i product.msi COUNTRY=US ENVIRONMENT=PROD
msiexec /x product.msi TRANSFORMS=":US_PROD;"

The following does not (installs fine, but uninstall fails):

msiexec /i product.msi COUNTRY=US ENVIRONMENT=PROD
msiexec /x product.msi COUNTRY=US ENVIRONMENT=PROD

Analysis

>From the install's debug log, it looks like the top-level, instead of the 
>instance-specific, product code is being used to populate the installer 
>database. This is also reflected in the description under Programs and 
>Features as if the instance-specific transform is being used to actually 
>install the files and registry entries, but not to create the installer record.

It seems the product code is being picked up and remembered before any sequence 
can kick in and intervene. I could be wrong, but from what I can tell, it 
happens every time I see the installer switching to a cached installer.

I have both the InstallUISequence and InstallExecuteSequence elements 
specified, but I can't seem to get the appropriate transform to be calculated 
and used for install/uninstall.

I've tried scheduling the transform calculation as early in the process as 
possible, going so far as to use InstEd to inspect the sequence and adjusting 
the WiX accordingly.

Code

Here's some excerpts of the relevant code.

<Property Id="InstanceId" Value="INVALID" />

<InstanceTransforms Property="InstanceId">
      <Instance Id="US_PROD" ProductName="Some Product US_PROD 1.0.0.0" 
ProductCode="<SOME-GENERATED-GUID-1>" />
      <Instance Id="US_QAT1" ProductName="Some Product US_QAT1 1.0.0.0" 
ProductCode="<SOME-GENERATED-GUID-2>" />
</InstanceTransforms>

<Property Id="COUNTRY" Value="INVALID" />
<Property Id="ENVIRONMENT" Value="INVALID" />

<Condition Message="COUNTRY and ENVIRONMENT properties must be specified during 
installation&#xD;&#xA;Example: msiexec /I &lt;path_to_msi&gt; 
COUNTRY=&quot;US&quot; ENVIRONMENT=&quot;QAT1&quot;"><![CDATA[Installed OR 
((COUNTRY <> "INVALID") AND (ENVIRONMENT <> "INVALID"))]]></Condition>

<!-- Store the instance-specific product code for uninstall/upgrade of a 
specific instance -->
<Property Id="INSTALLED_PRODUCTCODE">
      <RegistrySearch Id="INSTALLED_PRODUCTCODE" Type="raw" Root="HKLM" 
Key="Software\MyCompany\$(var.ApplicationId)\[InstanceId]" Name="ProductCode" />
</Property>

<!-- Custom actions that configure the installation -->
<CustomAction Id="SetInstanceId" Property="InstanceId" 
Value="[COUNTRY]_[ENVIRONMENT]" Execute="firstSequence" />
<CustomAction Id="SetTransforms" Property="TRANSFORMS" 
Value="{:[InstanceId];}[TRANSFORMS]" Execute="firstSequence" />
<!-- Set the special WiX property so only the current instance is upgraded or 
downgraded -->
<CustomAction Id="SetWixDowngradeDetected" Property="WIX_DOWNGRADE_DETECTED" 
Value="{[INSTALLED_PRODUCTCODE]}" Execute="firstSequence" />
<CustomAction Id="SetWixUpgradeDetected" Property="WIX_UPGRADE_DETECTED" 
Value="{[INSTALLED_PRODUCTCODE]}" Execute="firstSequence" />
<CustomAction Id="SetMsiNewInstance" Property="MSINEWINSTANCE" Value="1" 
Execute="firstSequence" />

<InstallUISequence>
      <Custom Action="SetInstanceId" Before="SetTransforms"><![CDATA[InstanceId 
= "INVALID"]]></Custom>
      <Custom Action="SetTransforms" 
Before="FindRelatedProducts"><![CDATA[INSTANCEID <> "INVALID"]]></Custom>
      <Custom Action="SetWixDowngradeDetected" 
After="AppSearch"><![CDATA[WIX_DOWNGRADE_DETECTED]]></Custom>
      <Custom Action="SetWixUpgradeDetected" 
After="AppSearch"><![CDATA[WIX_UPGRADE_DETECTED]]></Custom>
      <Custom Action="SetMsiNewInstance" Before="ExecuteAction"><![CDATA[ACTION 
= "INSTALL"]]></Custom>
</InstallUISequence>
<InstallExecuteSequence>
      <Custom Action="SetInstanceId" Before="SetTransforms"><![CDATA[InstanceId 
= "INVALID"]]></Custom>
      <Custom Action="SetTransforms" 
Before="FindRelatedProducts"><![CDATA[INSTANCEID <> "INVALID"]]></Custom>
      <Custom Action="SetWixDowngradeDetected" 
After="AppSearch"><![CDATA[WIX_DOWNGRADE_DETECTED]]></Custom>
      <Custom Action="SetWixUpgradeDetected" 
After="AppSearch"><![CDATA[WIX_UPGRADE_DETECTED]]></Custom>
      <Custom Action="SetMsiNewInstance" 
Before="InstallInitialize"><![CDATA[ACTION = "INSTALL"]]></Custom>
</InstallExecuteSequence>
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to