I've made use of the below for a while which uses an unadvertised shortcut:

      <Component Id="StartMenuShortCut1a335aa7_1214_4cf4_ac99_f2eb98654f9e" 
Guid="f5f4311a-d6f3-4bf6-b082-f26266b71831">
        <RegistryKey Root="HKCU" Key="Software\Statistics Canada\test" 
Action="createAndRemoveOnUninstall">
          <RegistryValue Name="IBca9d8fb1_7737_4062_b23f_f7e7162ae3c3" 
Value="1" Type="integer" KeyPath="yes" />
        </RegistryKey>
        <Shortcut Id="InstallerBuilderShortcutStartMenu" 
Directory="ApplicationProgramsFolder" Name="InstallerBuilder" 
WorkingDirectory="INSTALLDIR" Target="[#Fd5effb41790e4]" />
        <RemoveFolder Id="ApplicationsProgramFolder" On="uninstall" />
      </Component>


Note that we have a front end we've built to automate some of our WXS 
generation process (that's why the Ids look funny). This is actually from the 
front end's own installer!

I create the registry value as part of the installation of this product; that 
it is an HKCU one doesn't matter for the start menu change being for everyone - 
TS and all. We're using Server 2003 R2, but I cannot see how that would make a 
difference.



Keith Douglas
Statistics Canada | 170 Tunney's Pasture Driveway, Ottawa ON K1A 0T6
Statistique Canada | 170, promenade Tunney's Pasture, Ottawa ON K1A 0T6
keith.doug...@statcan.gc.ca
Telephone | Téléphone 613-951-4405
Facsimile | Télécopieur 613-951-1966
Government of Canada | Gouvernement du Canada 

-----Original Message-----
From: Charles Jenkins [mailto:cejw...@gmail.com] 
Sent: September-30-13 9:21 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] WiX disaster -- how did I cause it?

Hi! I'm a WiX noob, trying to write a simple installer for an in-house product. 
My installer caused a computing disaster, so obviously I've done something 
wrong, but I don't know what.

The disaster is this -- and believe me, I know at first blush it sounds nuts:

If I put the installer in a public location and then run it as a superuser to 
install on a Windows Terminal Server, everything works just fine for me. The 
icon gets created, I can run the program -- everything's cool.

But when another user logs in and double-clicks the newly installed program 
icon, the installer briefly appears saying the program will be installed; then 
the program starts, but a reboot is also scheduled on the server -- regardless 
of the fact that other users don't have privilege to reboot the server. The 
first day after installing my product was a nightmare, with the server 
rebooting every five or ten minutes when each new user tried to run my program.

The immediate solution was to remove the publicly available installer so the 
system couldn't run it. That would leave some users able to function and others 
not, so I also killed off the installer-created icon in Program Files and 
created a new one manually.

Okay, it sounds crazy. Why would an icon pointing to my program (which you can 
verify by looking at the installer script at the end of this email) run the 
installer again instead? The only thing I can figure is, the installer stores 
more information behind the scenes and knows where the icon came from. When I 
run it the first time, the installer has set everything up properly because I'm 
using the same account I originally installed from. When another, unprivileged 
user clicks the icon, the installer system knows something user-specific is 
missing, and so re-runs the installer to create that user-specific part before 
executing my program.

Well, there is one user-specific part I can easily find:

The installer is set to install perMachine, but the bit of code that creates 
the program folder has a registry key to be created on a per-user basis. Here's 
the section of code I'm referring to:

      <Directory Id="ProgramMenuFolder">
        <Directory Id="StartMenuDir" Name="TEC Timesheet" >
          <Component Id="StartMenuDir" 
Guid="D3EB384F-AA52-4AAF-AD55-F610C55DC2C7">
            <RemoveFolder Id="RemoveStartMenuDir" Directory="StartMenuDir" 
On="uninstall"/>
            <RegistryValue Root="HKCU" 
Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" 
KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>


If I change HKCU to HKLM, the installer won't compile. The error I get is 
"ICE38: Component StartMenuDir installs to user profile. It's KeyPath registry 
key must fall under HKCU."

So after I install in the superuser account, the superuser has this 
information; and after a brief trip to the installer, it gets set up for other 
users. That would be great if the installer didn't also schedule an unexpected 
reboot!

So: I'm doing something wrong. How can I make an installer that installs and 
creates icons for all users, even under Terminal Services, but which won't 
reboot the system the first time the a user double-clicks on my icon? Is there 
a different way to code the Component "StartMenuDir" when working with All 
Users?

FWIW, here's my entire WiX script:

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

  <Product Name="TEC Timesheet" Version="3.0.6.0" Manufacturer="TEC"
           Language="1033"
           Id="EC784F33-0A7C-4899-875B-5ADC75D7A670"
           UpgradeCode="0FF84A86-109F-40FD-9FE8-D2546C0D76E0">

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" 
/>

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is 
already installed." />
    <MediaTemplate EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="InstallDir" Name="TEC Timesheet">

          <Component Id="TimesheetExe"
                     Guid="31D4DF27-2476-4C39-AAD5-15625EBD5964">
            <File Id="Timesheet.exe"
                  Name="Timesheet.exe"
                  Vital="yes"
                  KeyPath="yes"
                  Checksum="yes"
                  Source="$(var.Timesheet.TargetPath)">
              <Shortcut Id="TimesheetStartMenuShortcut"
                        Directory="StartMenuDir"
                        Advertise="yes"
                        Name="Timesheet"
                        WorkingDirectory="InstallDir"
                        Icon="TimesheetIcon.exe">
                <Icon Id="TimesheetIcon.exe"
                      SourceFile="$(var.Timesheet.TargetPath)"/>
              </Shortcut>
            </File>
          </Component>

          <Component Id="SapDataDll" 
Guid="F7A92866-88EA-4075-86DC-946BEB87D320">
            <File Source="$(var.Timesheet.TargetDir)\\Interop.SAPbobsCOM.dll" 
Checksum="yes" />
          </Component>

          <Component Id="TimesheetDll" 
Guid="29005081-6F69-4125-85AC-F1BCDF1A229A" >
            <File Source="$(var.Timesheet.TargetDir)\\TimesheetLibrary.dll"  
Checksum="yes" />
          </Component>

        </Directory>
      </Directory>

      <Directory Id="ProgramMenuFolder">
        <Directory Id="StartMenuDir" Name="TEC Timesheet" >
          <Component Id="StartMenuDir" 
Guid="D3EB384F-AA52-4AAF-AD55-F610C55DC2C7">
            <RemoveFolder Id="RemoveStartMenuDir" Directory="StartMenuDir" 
On="uninstall"/>
            <RegistryValue Root="HKCU" 
Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" 
KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>

    </Directory>

    <Feature Id="ProductFeature" Title="Complete" Level="1">
      <ComponentRef Id="StartMenuDir" />
      <ComponentRef Id="TimesheetExe" />
      <ComponentRef Id ="TimesheetDll" />
      <ComponentRef Id ="SapDataDll" />
    </Feature>
  </Product>

</Wix>

--

Charles

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register > 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to