Very interesting, I've never thought to try to do it that way.   FWIW,  you 
can also use /qb instead of /qn.  In a QB scenario the UI sequence is 
processed but authored UI ( dialogs ) are skipped.  This is one way to get 
those CA's to fire and while it isn't a "silent" install it is a 
"non-interactive"  install.   Still, be careful to block the install with a 
LaunchCondition or Type 19 Error CA if the event someone calls /QN.


Or do what I do and invest in some bootstrapping code.

----------------------------------------

From: "Lance Arlaus - Consultant" <lance.arl...@weightwatchers.com>

Sent: Wednesday, December 21, 2011 10:14 AM

To: "General discussion for Windows Installer XML toolset." 
<wix-users@lists.sourceforge.net>

Subject: Re: [WiX-users] Multi-Instance No UI Install/Uninstall Problem


Thanks Christopher. Your comments sent me in right direction.


The root cause came down to the fact that, as you mentioned, the TRANSFORMS 
and MSINEWINSTANCE properties must be supplied on the command line (or via 
a bootstrapper as you've done) since those properties get processed prior 
to the start of the sequence actions.


The install worked in the case of a UI enabled install since the properties 
are set in the first sequence (InstallUISequence) and available by the time 
the second sequence (InstallExecuteSequence) initializes. Of course, 
running msiexec with the /qn option skips that first sequence, so they're 
not set when InstallExecuteSequence initializes.


I removed the custom actions that set the TRANSFORMS and MSINEWINSTANCE 
properties. I'd seen that solution online - a good case of caveat emptor. 
Note that without the MSINEWINSTANCE property, the TRANSFORMS property 
value from the command line is ignored and set to the last installed value 
instead.


So, something like the following now works to install/uninstall.


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

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


-----Original Message-----

From: Christopher Painter [mailto:chr...@iswix.com] 

Sent: Tuesday, December 20, 2011 8:51 PM

To: General discussion for Windows Installer XML toolset.; 
wix-users@lists.sourceforge.net

Subject: Re: [WiX-users] Multi-Instance No UI Install/Uninstall Problem


Make sure you are using the MSINEWINSTANCE property also.


BTW, I've never heard of an ability to apply a transform while the install 


is running. I always thought you had to apply it when you called the MSI 

like you are doing with the TRANSFORMS=":SomeEmbeddedTransform.mst". This 

is why I've written a custom setup.exe bootstrapper to handle the business 


logic and invoke the MSI with the right params.


----------------------------------------


From: "Lance Arlaus - Consultant" <lance.arl...@weightwatchers.com>


Sent: Tuesday, December 20, 2011 7:12 PM


To: "wix-users@lists.sourceforge.net" <wix-users@lists.sourceforge.net>


Subject: [WiX-users] Multi-Instance No UI Install/Uninstall Problem


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


----------------------------------------------------------------------------
--

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


----------------------------------------------------------------------------
--

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


------------------------------------------------------------------------------
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