单个包创作

Single Package Authoring

我正在尝试使用以下教程创建单一包创作安装 - http://www.egoroff.spb.ru/blog/62003.html
主 wix 文件如下:

<?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>

根据本教程,如果应用程序将由普通用户安装,则将安装它 "per user",如果应用程序将由管理员安装,则应安装它 "per machine"。
在我的例子中,如果我 运行 msi 文件作为一个普通用户,那么这个测试应用程序是为每个用户安装的。
但是,如果我 运行 cmd.exe "as administrator" 然后 运行 从该管理员的 cmd.exe 应用程序创建了 msi 文件,那么应用程序将再次按用户安装,而不是按机器安装。
我应该怎么做才能在每台机器上安装应用程序?
我应该更改 wxs 代码中的某些内容吗?
或者我应该使用其他方法安装我的应用程序吗?

尝试在 msiexec.exe 命令行上设置 ALLUSERS=1。这会产生一个每台机器安装,并为所有用户共享快捷方式:

msiexec.exe /i File.msi ALLUSERS=1 

这与更大的问题“Installation context”有关。查看链接的 MSDN 文档。

推荐链接: