Author Topic: WiX: Condition of checking of installing other component  (Read 1405 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 860
WiX: Condition of checking of installing other component
« on: June 10, 2016, 10:08:53 AM »
WiX project.

I write the plugin for AutoCAD application. It contains additional localization (Russian) and the set of DLL for different AutoCAD versions. User can select what features he want to install:



My plugin contains the localized resources are the .\ru\*.resource.dll files. When Russian localization is switched on, then all russian resource files will be installed (for each AutoCAD version), even if some AutoCAD versions will be switched off. This is bad way.

For this problem solving I  add to the  localized resources components the additional `Condition` elements.

Code - XML: [Select]
  1.     <!-- Plugin for three AutoCAD versions. -->
  2.     <DirectoryRef Id="BIN" FileSource="$(var.R172.TargetDir)">
  3.       <Component Id="$(var.R172.TargetFileName)" Guid="{D93DBF0B-B288-40D3-BAE4-4C1EBA1D8046}">
  4.         <File Id="$(var.R172.TargetFileName)" Name="$(var.R172.TargetFileName)" KeyPath="yes"/>
  5.       </Component>
  6.       <Component Id="$(var.R182.TargetFileName)" Guid="{2D83091E-0451-4BE6-A401-1A0579568D6A}">
  7.         <File Id="$(var.R182.TargetFileName)" Name="$(var.R182.TargetFileName)" KeyPath="yes"/>
  8.       </Component>
  9.       <Component Id="$(var.R190.TargetFileName)" Guid="{60FEC4D8-16E1-4AC3-846B-CE49F82B6BD9}">
  10.         <File Id="$(var.R190.TargetFileName)" Name="$(var.R190.TargetFileName)" KeyPath="yes"/>
  11.       </Component>
  12.     </DirectoryRef>
  13.    
  14.     <!-- Localized resources -->
  15. <DirectoryRef Id="BIN_RU" FileSource="$(var.R172.TargetDir)ru">
  16.   <Component Id="$(var.R172.TargetName).resources$(var.R172.TargetExt)"
  17.             Guid="{BF9EA8F2-2619-46A5-9418-C823C497CFAA}">
  18.     <File Id="$(var.R172.TargetName).resources$(var.R172.TargetExt)"
  19.          Name="$(var.R172.TargetName).resources$(var.R172.TargetExt)" KeyPath="yes"/>
  20.     <Condition><![CDATA[&Acad2009_2011 = 3]]></Condition>
  21.   </Component>
  22.   <Component Id="$(var.R182.TargetName).resources$(var.R182.TargetExt)"
  23.             Guid="{5D9CB24C-B451-425D-A58F-95D1B2AA7A7B}">
  24.     <File Id="$(var.R182.TargetName).resources$(var.R182.TargetExt)"
  25.          Name="$(var.R182.TargetName).resources$(var.R182.TargetExt)" KeyPath="yes"/>
  26.     <Condition><![CDATA[&Acad2012 = 3]]></Condition>
  27.   </Component>
  28.   <Component Id="$(var.R190.TargetName).resources$(var.R190.TargetExt)"
  29.             Guid="{00F67E07-62FB-4156-8AB9-9B05F02E35B3}">
  30.     <File Id="$(var.R190.TargetName).resources$(var.R190.TargetExt)"
  31.          Name="$(var.R190.TargetName).resources$(var.R190.TargetExt)" KeyPath="yes"/>
  32.     <Condition><![CDATA[&Acad2013_2017 = 3]]></Condition>
  33.   </Component>
  34. </DirectoryRef>
  35.    
  36.     <!-- Here I group my components: -->
  37.     <DirectoryRef Id="BIN_RU" FileSource="$(var.R172.TargetDir)ru">
  38.       <Component Id="$(var.R172.TargetName).resources$(var.R172.TargetExt)"
  39.                 Guid="{BF9EA8F2-2619-46A5-9418-C823C497CFAA}">
  40.         <File Id="$(var.R172.TargetName).resources$(var.R172.TargetExt)"
  41.              Name="$(var.R172.TargetName).resources$(var.R172.TargetExt)" KeyPath="yes"/>
  42.         <Condition><![CDATA[&Acad2009_2011 = 3]]></Condition>
  43.       </Component>
  44.       <Component Id="$(var.R182.TargetName).resources$(var.R182.TargetExt)"
  45.                 Guid="{5D9CB24C-B451-425D-A58F-95D1B2AA7A7B}">
  46.         <File Id="$(var.R182.TargetName).resources$(var.R182.TargetExt)"
  47.              Name="$(var.R182.TargetName).resources$(var.R182.TargetExt)" KeyPath="yes"/>
  48.         <Condition><![CDATA[&Acad2012 = 3]]></Condition>
  49.       </Component>
  50.       <Component Id="$(var.R190.TargetName).resources$(var.R190.TargetExt)"
  51.                 Guid="{00F67E07-62FB-4156-8AB9-9B05F02E35B3}">
  52.         <File Id="$(var.R190.TargetName).resources$(var.R190.TargetExt)"
  53.              Name="$(var.R190.TargetName).resources$(var.R190.TargetExt)" KeyPath="yes"/>
  54.         <Condition><![CDATA[&Acad2013_2017 = 3]]></Condition>
  55.       </Component>
  56.     </DirectoryRef>
  57.    
  58.     <!-- AutoCAD 2009-2011 plugin -->
  59.     <ComponentGroup Id="Bin_2009">
  60.       <ComponentRef Id="$(var.R172.TargetFileName)"/>
  61.     </ComponentGroup>
  62.     <!-- AutoCAD 2012 plugin -->
  63.     <ComponentGroup Id="Bin_2012">
  64.       <ComponentRef Id="$(var.R182.TargetFileName)"/>
  65.     </ComponentGroup>
  66.     <!-- AutoCAD 2013 plugin -->
  67.     <ComponentGroup Id="Bin_2013">
  68.       <ComponentRef Id="$(var.R190.TargetFileName)"/>
  69.     </ComponentGroup>
  70.    
  71.     <!-- This group contains Russian localized resources for all AutoCAD versions -->
  72.     <ComponentGroup Id="Bin_ru">
  73.       <ComponentRef Id="$(var.R172.TargetName).resources$(var.R172.TargetExt)"/>
  74.       <ComponentRef Id="$(var.R182.TargetName).resources$(var.R182.TargetExt)"/>
  75.       <ComponentRef Id="$(var.R190.TargetName).resources$(var.R190.TargetExt)"/>
  76.     </ComponentGroup>
  77.    
  78.     <!-- Now I locate my component groups into the Features -->
  79.    
  80.     <Feature Id="Russian" Title="Russian" Description="Install Russian localization." Level="1000"
  81.             AllowAdvertise='no' InstallDefault='local' Absent='allow' Display='expand' TypicalDefault='install'>
  82.       <ComponentGroupRef Id="Cui_ru" />
  83.       <ComponentGroupRef Id="Cuix_ru" />
  84.       <ComponentGroupRef Id="Help_ru" />
  85.       <ComponentGroupRef Id="Bin_ru" />
  86.       <ComponentGroupRef Id="Licenses_ru" />
  87.     </Feature>
  88.    
  89.     <Feature Id="Acad2009_2011" Title="AutoCAD 2009-2011" Description="Install extension for AutoCAD 2009-2011"
  90.             AllowAdvertise='no' InstallDefault='local' Absent='allow' Display='expand' Level="1"
  91.             TypicalDefault='install'>
  92.       <ComponentGroupRef Id="Bin_2009" />
  93.     </Feature>
  94.     <Feature Id="Acad2012" Title="AutoCAD 2012" Description="Install extension for AutoCAD 2012" TypicalDefault='install'
  95.             AllowAdvertise='no' InstallDefault='local' Absent='allow' Display='expand' Level="1">
  96.       <ComponentGroupRef Id="Bin_2012" />
  97.     </Feature>
  98.     <Feature Id="Acad2013_2017" Title="AutoCAD 2013-2017" Description="Install extension for AutoCAD 2013-2017"
  99.             AllowAdvertise='no' InstallDefault='local' Absent='allow' Display='expand' Level="1" TypicalDefault='install'>
  100.       <ComponentGroupRef Id="Bin_2013" />
  101.     </Feature>

I expect that when Russian localization is switched on and any AutoCAD version is switched on then the localized resource of that AutoCAD will be installed. But it doesn't happen. Localized *.resources.dll files wasn't installed.

In the log file I see this:

Code: [Select]
MSI (s) (D8:9C) [15:56:16:334]: Feature: Acad2009_2011; Installed: Absent;   Request: Local;   Action: Local
MSI (s) (D8:9C) [15:56:16:334]: Feature: AcadVersions; Installed: Absent;   Request: Local;   Action: Local
MSI (s) (D8:9C) [15:56:16:334]: Feature: Acad2012; Installed: Absent;   Request: Local;   Action: Local
MSI (s) (D8:9C) [15:56:16:334]: Feature: Acad2013_2017; Installed: Absent;   Request: Local;   Action: Local
...
MSI (s) (D8:9C) [15:56:16:334]: Component: ProxyTools.R17.2.resources.dll; Installed: Absent;   Request: Local;   Action: Null
MSI (s) (D8:9C) [15:56:16:334]: Component: ProxyTools.R18.2.resources.dll; Installed: Absent;   Request: Local;   Action: Null
MSI (s) (D8:9C) [15:56:16:334]: Component: ProxyTools.R19.0.resources.dll; Installed: Absent;   Request: Local;   Action: Null

Why the components of my localized resources have Action is Null instead of Local?
« Last Edit: June 11, 2016, 01:52:06 PM by Andrey Bushman »

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Re: WiX: Condition of checking of installing other component
« Reply #1 on: June 11, 2016, 04:15:28 PM »
I found answer here.

CADbloke

  • Bull Frog
  • Posts: 309
  • Crash Test Dummy
Re: WiX: Condition of checking of installing other component
« Reply #2 on: June 12, 2016, 07:28:26 PM »
I found answer here.
Thank you for posting that, that page and the whole blog are really useful. I too am having "lots of fun" with Wix: http://forums.autodesk.com/t5/net/realdwg-installer-why-so-cryptic/td-p/6341741

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Re: WiX: Condition of checking of installing other component
« Reply #3 on: June 13, 2016, 04:07:24 AM »
Hi CADbloke,
Thank you for posting that, that page and the whole blog are really useful.
If you create MSI installers for your AutoCAD extensions, then this my theme, can be interesting for you also: http://stackoverflow.com/questions/37763204/why-the-installfolder-property-was-not-changed-through-the-radiobuttongroup

Note
On the screen of that theme you see the "Program Files (x86)" instead of "Program Files". Don't worry about it. It is because I compiled that sample on Windows x64 for the x86 platform instead of x64. For the target platform x64 it will be "Program Files".

Best regards, Andrey
« Last Edit: June 13, 2016, 04:24:06 AM by Andrey Bushman »

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Re: WiX: Condition of checking of installing other component
« Reply #4 on: June 13, 2016, 04:15:06 AM »
I found answer here.
I meaned that I found that the simple decision of my question is not exist. I still don't understand how to do this operation:
Quote from: Bob Arnson
Schedule the custom action before CostFinalize.
I try to learn it.
« Last Edit: June 13, 2016, 04:25:01 AM by Andrey Bushman »