单一包装编写

时间:2015-06-10 16:22:55

标签: wix windows-installer

我正在尝试使用以下教程创建单一程序包创作安装 - 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>

根据本教程,如果应用程序将由普通用户安装,那么它将“按用户”安装,如果应用程序将由管理员安装,那么它应该“按机器”安装。
在我的情况下,如果我以普通用户身份运行msi文件,则按用户安装此测试应用程序 但是,如果我“以管理员身份”运行cmd.exe,然后从该管理员的cmd.exe应用程序运行已创建的msi文件,则会再次为每个用户安装应用程序,而不是按机器安装。
如何在每台机器上安装应用程序? 我应该用wxs代码改变一些东西吗? 或者我应该使用其他方法安装我的应用程序?

1 个答案:

答案 0 :(得分:0)

尝试在msiexec.exe命令行上设置ALLUSERS=1。这样就可以为每台计算机安装所有用户提供共享快捷方式:

msiexec.exe /i File.msi ALLUSERS=1 

这涉及&#34; Installation context&#34;的更大问题。查看链接的MSDN文档。

推荐链接

相关问题