我正在尝试将一些文件安装到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:\。所以问题是:我在目录上做错了什么?
答案 0 :(得分:1)
事实证明,使用/ 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:\'.
如果使用/ i选项启动msi,则不会发生目录重置。由于需要使用提升的权限安装软件包,因此正确的方法是在提升的CMD控制台中使用/ i选项。标记从来都不是问题。