I've created a very simple installer to test some things.  In this case, we 
deploy 32-bit and 64-bit assemblies that are very similar.  I thought it would 
be easiest to make a WixLib project, write the logic to get the assemblies 
based on the Platform.  This has so far worked very well.  I reference the 
WiXlib project output in my installer, place the WiXLib project's component in 
the correct spot in the main installer's feature tree and all seems fine; it 
installs the WiXLib files and registry keys as expected.  However, upon 
uninstall only the files/keys listed in the main MSI's XML are uninstalled, 
while the WiXLib's files/keys are left behind.  I've tried messing around with 
the InstallExecuteSequence a bit, but as I'm really new to WiX I think that's 
barking up the wrong tree.  Please don't suggest I not use a lib (merge module 
is ok, too, but I understand Lib is the way to go).  Having this parallel is 
definitely required; it would keep maintenance to a minimum. 

On another note, I was trying to ascertain the full, calculated path to a 
directory as configured by the user at install-time so that I can set registry 
keys (noted below as "ID_LIKE_TO_SET_THIS_DYNAMICALLY").  How would I do that?

Here's some example XML of what I'm doing:

Project.wxs (yes, I have the defines for the preproc variables), this is built 
as MSI and the project has a reference to AssembliesLib's output:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension";>

  <Product Id="MY_GUID_IS_REALLY_HERE"
           Name="$(var.Name)"
           Language="1033"
           Version="$(var.Version)"
           Manufacturer="$(var.Manufacturer)"
           UpgradeCode="B00BC38E-F2E6-4E95-A0C2-6FA54BA1DFB4">

    <Package Id="*"
             Keywords="Installer"
             Manufacturer="$(var.Manufacturer)"
             Description="$(var.Description)"
             InstallPrivileges="elevated"
             InstallerVersion="200"
             Compressed="yes"
             InstallScope="perMachine" />


    <Media Id="1" Cabinet="my.cab" EmbedCab="yes" />

    <PropertyRef Id="NETFRAMEWORK20"/>
    <Condition Message="This application requires .NET Framework 2.0. Please 
install the .NET Framework then run this installer again.">
      <![CDATA[NETFRAMEWORK20]]>
    </Condition>

    <UI>
      <UIRef Id="WixUI_Advanced" />
      <Publish Dialog="ExitDialog"
               Control="Finish"
               Event="DoAction"
               Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 
and NOT Installed</Publish>
    </UI>
    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Register and 
license $(var.Name) now" />
    <Property Id="WixShellExecTarget" Value="[#Activation.exe]" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" 
DllEntry="WixShellExec" Impersonate="yes" />

    <Property Id="ApplicationFolderName" Value="MyApplication" />
    <Property Id="WixAppFolder" Value="WixPerMachineFolder" />
    <WixVariable Id="WixUILicenseRtf" Value="c:\Path\to\license.rtf" />
    <WixVariable Id="WixUIBannerBmp" Value="BitMaps\bannrbmp.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="BitMaps\dlgbmp.bmp" />

    <Icon Id="icon.ico" SourceFile="BitMaps\Icon.ico" />
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />

    <Directory Id="TARGETDIR" Name="SourceDir" >
      <Directory Id="ProgramMenuFolder" />
      <Directory Id="ProgramFilesFolder">
        <Directory Id="APPLICATIONFOLDER" Name="MyApplication">
          <Directory Id="DI" Name="$(var.DIdir)" >
            <Directory Id="bin" Name="bin" />
          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <DirectoryRef Id="DI">
      <Component Id="Main" Guid="ANOTHER_GUID" UninstallWhenSuperseded="yes">
        <!-- This file gets uninstalled -->
        <File Name="Activation.exe" Source="X:\path\to\activation.exe" />
      </Component>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="$(var.Name)" Level="1" 
Display="expand">
      <ComponentRef Id="Main" />
      <Feature Id="ProductFeature" Title="Win32Binaries" Level="1" >
        <ComponentRef Id="32bit_Assemblies"/>
      </Feature>
    </Feature>
  </Product>
</Wix>


AssembliesLib, output type is wixlib (the preprocs are defined based on the 
platform):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
  <Fragment>
    <DirectoryRef Id="bin">
      <Directory Id="$(var.x86x64)" Name="$(var.x86x64)">
        <Component Id="$(var.ModuleId)" Guid="$(var.ComponentId)">
          <!-- This key does NOT get removed -->
          <RegistryKey Root="HKLM"
                       
Key="Software\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\MyApplication"
 
                       Action="createAndRemoveOnUninstall">
            <RegistryValue Type="string" 
Value="C:\ID_LIKE_TO_SET_THIS_DYNAMICALLY\bin\$(var.x86x64)" />
          <!-- This file does NOT get uninstalled -->
          <File Name="$(var.MyProject.TargetFileName)"    
Source="$(var.MyProject.TargetPath)" />
        </Component>
      </Directory>
    </DirectoryRef>
  </Fragment>
</Wix>


Thanks a lot guys!  WiX is awesome.  Our existing "script" is ~2k lines and I 
think I'm going to be able to replace it with something that's ~300 XML lines.

-Dave T.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to