Thanx Jacob for the hint about multiple msi's with only one cab. 
I tried this approach today and it works fine. 

After a few days of googling the solution I understand that it wasn't good idea 
to use transformations :(


31.07.2014, 22:43, "Hoover, Jacob" <jacob.hoo...@greenheck.com>:
> Instances are ugly...  And to do them right would be very difficult.  There 
> aren't many restrictions to what a transform can do, so all the assumptions 
> that are made at compile time of the bundle would have to be re-evaluated.
>
> My preference would be to have multiple predefined MSI's, and use a single 
> external CAB that's common among all of them.
>
> -----Original Message-----
> From: Wesley Manning [mailto:wmann...@dynagen.ca]
> Sent: Thursday, July 31, 2014 12:50 PM
> To: 'General discussion about the WiX toolset.'
> Cc: 'Sergey Kozhemyachenko'
> Subject: Re: [WiX-users] Multiple Instance installations from wix BA 
> application
>
> I think you're the third or fourth person to ask on this mailing list in the 
> last year.  It's not supported.  There was a discussion on this mailing list 
> some time ago if I recall.
>
> -----Original Message-----
> From: serkbugs [mailto:serkb...@yandex.ru]
> Sent: July-31-14 5:51 AM
> To: wix-users@lists.sourceforge.net
> Cc: Sergey Kozhemyachenko
> Subject: [WiX-users] Multiple Instance installations from wix BA application
>
> Hi,
>
> Our customer wants to install multiple instances of windows service per each 
> service(like SQL server installation with multiple instances).
>
> I was trying to build a prototype using custom BA 
> application(Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperApp
> lication).
>
> I've read a lot of topics around  InstanceTransforms in msi and it looks like 
> I can start it work from msi with msiexec /i MultiInstance.msi
> MSINEWINSTANCE=1 TRANSFORMS=":I01" but I cannot understand how to run it 
> properly from BA.
>
> Here is some pieces from my prototype.
>
> Msi(please don't pay attention to extra actions and properties):
> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
>       xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";>
>     <Product Id="$(var.I00)" Name="$(var.ProductName32)" Language="1033"
> Version="$(var.CurrentVersion)" Manufacturer="Me inc"
> UpgradeCode="$(var.UpgradeGuid)">
>         <Package InstallerVersion="200" Compressed="yes"
> InstallScope="perMachine" />
>         <MajorUpgrade AllowDowngrades="no" AllowSameVersionUpgrades="yes"
>                       DowngradeErrorMessage="You can't downgrade this 
> application" Schedule="afterInstallExecute" MigrateFeatures="yes"/>
>
>         <MediaTemplate EmbedCab="yes" />
>         <Feature Id="ProductFeature" Title="SetupProjectTest" Level="1">
>             <ComponentGroupRef Id="ProductComponents" />
>         </Feature>
>         <Property Id="PATHTOCOPY" Secure="yes"></Property>
>         <Property Id="PATHTOCOPYTO" Secure="yes"></Property>
>         <Binary Id='CustomAction'
> SourceFile="$(var.TestCustomAction.TargetDir)TestCustomAction.CA.dll" />
>
>         <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
>         <Property Id='REINSTALLMODE' Value='amus'/>
>         <Property Id='ServiceName' Value='Test Service Name 2'/>
>       <Property Id='INSTANCEID' Value='I01'>
>         <RegistrySearch Id="InstanceIdSearch" Root="HKLM"
> Key="Software\[Manufacturer]\[ProductCode]\$(var.ProductName32)"
> Name="InstanceId" Type="raw" />
>       </Property>
>         <InstanceTransforms Property='INSTANCEID'>
>           <Instance Id='I01' ProductCode='$(var.I01)' ProductName='I01'/>
>           <Instance Id='I02' ProductCode='$(var.I02)' ProductName='I02'/>
>           <Instance Id='I03' ProductCode='$(var.I03)' ProductName='I03'/>
>         </InstanceTransforms>
>     </Product>
> ........
>
> Bundle:
>
> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
>      xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
>      xmlns:bal="http://schemas.microsoft.com/wix/BalExtension";>
>
>     <Bundle Name="$(var.ProductName)" Version="$(var.CurrentVersion)"
> Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeGuid)">
>
>       <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
>         <Payload
> SourceFile="$(var.TestBootstrapperApplication.TargetDir)BootstrapperCore.con
> fig"/>
>         <Payload
> SourceFile="$(var.TestBootstrapperApplication.TargetDir)TestBootstrapperAppl
> ication.dll"/>
>         <Payload
> SourceFile="$(var.TestBootstrapperApplication.TargetDir)GalaSoft.MvvmLight.W
> PF4.dll"/>
>         <Payload SourceFile="c:\Program Files (x86)\WiX Toolset 
> v3.7\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
>       </BootstrapperApplicationRef>
>
>         <Variable Name="DIR_EXISTS" Value="NO" Persisted="yes" Type="string"
> />
>         <Variable Name="PATHTOAPP" Value="c:\program files 
> (x86)\SetupProjectTest\" Persisted="yes" Type="string" />
>
>       <Chain>
>             <PackageGroupRef Id="NetFx40Web" />
>             <PackageGroupRef Id="pkgMsi"/>
>         </Chain>
>
>     </Bundle>
> </Wix>
>
> another bundle file:
>  <Fragment>
> ......
>   <Variable Name='TRANSFORMS' bal:Overridable="yes"/>
>   <Variable Name='MSINEWINSTANCE' bal:Overridable="yes"/> ..........
>   <PackageGroup Id="pkgMsi">
>             <MsiPackage Id="package32"
>
> SourceFile="$(var.SetupProjectTest.TargetDir)\SetupProjectTest.msi"
>                   Vital="yes"
>                   LogPathVariable="WixBundleLog_package32"
>                   DisplayInternalUI="yes"
>                   EnableFeatureSelection="no"
>                   SuppressSignatureVerification="yes"
>                   ForcePerMachine="yes"
>                   InstallCondition="NOT TRANSFORMS"
>               <MsiProperty Name="INSTALLFOLDER" Value="[INSTALLFOLDER]"/>
>             </MsiPackage>
>
>             <MsiPackage Id="package32Multiple"
>
> SourceFile="$(var.SetupProjectTest.TargetDir)\SetupProjectTest.msi"
>                         Vital="yes"
>                         LogPathVariable="WixBundleLog_package32"
>                         DisplayInternalUI="yes"
>                         EnableFeatureSelection="no"
>                         SuppressSignatureVerification="yes"
>                         ForcePerMachine="yes"
>                         InstallCondition="TRANSFORMS"
>               <MsiProperty Name="TRANSFORMS" Value=":I01"/>
>               <MsiProperty Name="MSINEWINSTANCE" Value="[MSINEWINSTANCE]"/>
>               <MsiProperty Name="INSTALLFOLDER" Value="[INSTALLFOLDER]"/>
>             </MsiPackage>
>
>         </PackageGroup>
> I'm using the same msi but with different set of properties depends on some 
> settings in BA.
>
> In BA code I'm trying to ask engine to set state in state I need:
>
> private void OnPlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
>         {
>            //I have a model of packages and their statuses
>             var package = this._bundle.Packages.FirstOrDefault(p => 
> p.Id.Equals(e.PackageId, StringComparison.CurrentCultureIgnoreCase));
>             if (package != null)
>             {
>                 e.State = package.RequestState; // is set to 
> RequestState.Present for packages I want to update
>             }
>         }
>
> After I run my bundle.exe for second time and change package state in the 
> state I need(also set TRANSFORMS and MSINEWINSTANCE) in OnPlanPackageBegin I 
> can see in my logs such strings:
>
> [14BC:101C][2014-07-31T04:45:25]i201: Planned package: package32Multiple,
> state: Present, default requested: Absent, ba requested: None, execute:
> None, rollback: None, cache: No, uncache: No, dependency: Unregister
> [14BC:101C][2014-07-31T04:45:25]i201: Planned package: package32, state:
> Present, default requested: Absent, ba requested: Absent, execute:
> Uninstall, rollback: Install, cache: No, uncache: Yes, dependency:
> Unregister
>
> As far as I understand main problem here that Engine detected package as 
> Present and it doesn't matter what I have in "ba requested".
>
> How can I change this behaviour?
> Are there any ways to say Engine execute action I need(Install, uninstall,
> etc.) ?
>
> Any help will be really helpful.
>
> Regards,
> Sergey.
>
> ----------------------------------------------------------------------------
> --
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to