Single Package Authoring

632 views Asked by At

I am trying to create Single Package Authoring installation using following tutorial - http://www.egoroff.spb.ru/blog/62003.html
Main wix file is following:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Foobar 1.0' Id='GUID' UpgradeCode='GUID'
    Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>

    <Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer"
      Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
      InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

    <Property Id="ALLUSERS" Secure="yes" Value="2" />
    <Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
    <Property Id='ApplicationFolderName' Value="Acme" />
    <Property Id='WixAppFolder' Value="WixPerUserFolder" />

    <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
    <Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='Acme' Name='Acme'>
          <Directory Id='INSTALLDIR' Name='Foobar 1.0'>

            <Component Id='MainExecutable' Guid='GUID'>
              <File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1' Source='FoobarAppl10.exe' KeyPath='yes'>
                <Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="Foobar 1.0" WorkingDirectory='INSTALLDIR' Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
              </File>
            </Component>

          </Directory>
        </Directory>
      </Directory>

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="Foobar 1.0">
          <Component Id="ProgramMenuDir" Guid="GUID">
            <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
            <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
          </Component>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id='Complete' Title='Foobar 1.0' Description='The complete package.'
      Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
      <Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
        <ComponentRef Id='MainExecutable' />
        <ComponentRef Id='ProgramMenuDir' />
      </Feature>
    </Feature>

    <Icon Id="Foobar10.exe" SourceFile="FoobarAppl10.exe" />

    <UI Id="MyWixUI_Mondo">
      <UIRef Id="WixUI_MySetup" />
    </UI>

  </Product>
</Wix>

According to this tutorial if application will be installed by plain user then it will be installed "per user", if application will be installed by administrator, then it should be installed "per machine".
In my case if I run msi file as a plain user then this test application is installed per user.
But if I run cmd.exe "as administrator" and then run created msi file from that administrator's cmd.exe application then application is installed per user again, not per machine.
What should I do to install application per machine?
Should I change something in wxs code?
Or should I install my application using some other approach?

1

There are 1 answers

0
Stein Åsmul On BEST ANSWER

Try setting ALLUSERS=1 on the msiexec.exe command line. This yields a per machine installation with shared shortcuts for all users:

msiexec.exe /i File.msi ALLUSERS=1 

This relates to the larger issue of "Installation context". Check out the linked MSDN documentation.

Recommended links: