在WiX中安装文件到windows目录



我正在尝试安装一些文件到WindowsFolder。下面是标记:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="MyAppSetup" Language="1033" Version="1.0.0.0" Manufacturer="abc" UpgradeCode="C313D73A-0FE5-496C-BD86-C21565BD65ED">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />
        <Feature Id="ProductFeature" Title="MyAppSetup" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="WindowsFolder">
                <Directory Id="INSTALLFOLDER" />
            </Directory>
        </Directory>
    </Fragment>
    <Fragment>
     <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="myApp1" Guid="13B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myApp.pdb" Source="myApp64.pdb" KeyPath="yes" />
      </Component>
      <Component Id="myApp2" Guid="23B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myApp.sys" Source="myApp64.sys" KeyPath="yes" />
      </Component>
      <Component Id="myApp3" Guid="33B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myAppsvc.exe" Source="myAppsvc64.exe" KeyPath="yes" />
      </Component>
      <Component Id="myApp4" Guid="43B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myAppsvc.pdb" Source="myAppsvc64.pdb" KeyPath="yes" />
      </Component>
     </ComponentGroup>
    </Fragment>
</Wix>

根据我的阅读,这个目录元素指定要安装/复制的文件在WindowsFolder下(在我的机器C:windows上),但相反,它将文件安装到空间最大的D:。问题是:我在目录上做错了什么?

结果是,当使用/a (admin)选项通过msiexec启动msi时,会发生目录重置。以下是一些日志条目:

PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:'.
PROPERTY CHANGE: Modifying WindowsFolder property. Its current value is 'C:windows'. Its new value: 'D:'.
PROPERTY CHANGE: Adding APPLICATIONROOTDIRECTORY property. Its value is 'D:'.

如果msi使用/i选项启动,则没有发生目录重置。由于包需要以提升的权限安装,正确的方法是在提升的CMD控制台中使用/i选项。涨价从来都不是问题所在。

相关内容

  • 没有找到相关文章

最新更新