0

This is a repeat of Wix - Keeping track of installed applications, but the accepted answer just suggested that one could do something different than what was asked.

So, (in WiX) how does one make Per Machine installers for separate products from a single company with each having shortcuts under Start Menu/Programs/CompanyName/ProductName (where ProductName changes for each product) such that Start Menu/Programs/CompanyName will be removed if and only if all the products are uninstalled?

The specific names don't matter, but for discussion assume CompanyName is ExampleLLC with products named ProductA, ProductB, and ProductC. Assuming each product has a separate installer and the shortcuts are each to a file installed by the same product installer. So, call them RunA, RunB, and RunC targeted at ProductA.exe, ProductB.exe, and ProductC.exe respectively.

To be clear "Start Menu/Programs" maps to "C:\Users\All Users\Microsoft\Windows\Start Menu\Programs" under Windows 7, but other OS versions map this differently.

NOTE: The answer must work for perMachine installations and if ICE warnings must be ignored, please mention them.

This sounds trivial, but WiX and the Installer SDK emit errors or warnings at everything I've tried. They need a "key" to check if something (or collection thereof) is still present on the machine and have biases against both directories and shortcuts as keys. AND they put special requirements on items installed per user, but then don't trust that "ProgramMenuFolder" is NOT per user for a "perMachine" installation.

Community
  • 1
  • 1
SensorSmith
  • 1,129
  • 1
  • 12
  • 25
  • I don't fully understand exactly what you are doing. Please spell out the directory and shortcut names in question as well as the directory and filenames of their targets. – Christopher Painter Jun 27 '14 at 13:25
  • @ChristopherPainter if you change your answer to [the original question](http://stackoverflow.com/questions/3319927/wix-keeping-track-of-installed-applications) to include an extra directory level for the company name, I'll give you a +1 and support any action to close/kill this question. – SensorSmith Jun 27 '14 at 20:45
  • Umm, done. But I think it's ugly. My company only has one product so it's dumb to have ISWIX, LLC\IsWiX. Besides modern O/S 8/8.1 ignores all this anyways. – Christopher Painter Jun 27 '14 at 20:49

2 Answers2

0

Just include the same component (with the same GUID), which installs the shortcut, into two products. MSI will count and handle installed component by itself.

Vadim
  • 471
  • 6
  • 15
  • Also mark it as a Shared Component and use a destination directory such as [PFF]Company\Shared or [CFF]Company instead of a product specific folder. Or don't use shared components and package it into it's own MSI and use Burn to bundle P1.msi with C.msi and P2.msi with C.msi. Burn will then remove C.msi when the final P1 or P2 is removed. It depends on the complexity of (C). It's kinda hard to understand exactly what he's asking for. – Christopher Painter Jun 27 '14 at 13:27
0

Ignore ICE64 (i.e. tell light.exe to do so) and "just do it". But use advertised shortcuts or see the question Wix create non advertised shortcut for all users / per machine.
If you do those two things the extra nesting level for "CompanyName" won't matter.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="ProductA" Language="1033" Version="1.0.0.0" Manufacturer="ExampleLLC" UpgradeCode="YOUR_GUID_HERE">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="Setup.cab" EmbedCab="yes" CompressionLevel="high" />

    <Property Id="DISABLEADVTSHORTCUTS" Value="1" />

    <Directory Id="TARGETDIR" Name="SourceDir">

      <Directory Id="ProgramMenuFolder">
        <Directory Id="MyStartMenuCompanyFolder" Name="ExampleLLC">
          <Directory Id="MyStartMenuProductFolder" Name="ProductA" />
        </Directory>
      </Directory>

      <Directory Id="ProgramFilesFolder">
        <Directory Id="MyProgramFilesCompanyFolder" Name="ExampleLLC">
          <Directory Id="MyProgramFilesProductFolder" Name="ProductA">
            <Component Id="ProductA.exe">
              <File Source="../ProductA/bin/$(var.Configuration)/ProductA.exe" KeyPath="yes">
                <Shortcut Id="RunA" Name="RunA" Directory="MyStartMenuProductFolder" Advertise="yes"/>
              </File>
            </Component>
          </Directory>
        </Directory>
      </Directory>

    </Directory>

    <Feature Id="Complete" Level="1">
      <ComponentRef Id="ProductA.exe" />
    </Feature>
  </Product>
</Wix>

Produces 2 instances of ICE error 64 complaining that each directory (MyStartMenuProductFolder and MyStartMenuCompanyFolder) "is in the user profile but is not listed in the RemoveFile table".

If one makes a duplicate WiX file substituting ProductB for ProductA (and RunB for RunA), then ignoring this error produces installers that do just what they should.

So don't trust ICE64's implication that something won't get removed on uninstall. Ignore the error and just test your installer.

NOTE: This error has nothing to do with having an extra directory level, but in trying to dodge it AND fighting with ICE43 and ICE57 that pop up if you try to use a non-advertised shortcut led me "down a rabbit hole" involving using the inner directory (MyStartMenuProductFolder) as a KeyPath for a component including just the RunA shortcut. Which worked fine, but left the ICE64 warning for the outer directory (MyStartMenuCompanyFolder).

Community
  • 1
  • 1
SensorSmith
  • 1,129
  • 1
  • 12
  • 25