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.BootstrapperApplication). 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.config"/> <Payload SourceFile="$(var.TestBootstrapperApplication.TargetDir)TestBootstrapperApplication.dll"/> <Payload SourceFile="$(var.TestBootstrapperApplication.TargetDir)GalaSoft.MvvmLight.WPF4.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