如何解决如何设置WiX默认安装位置
我刚刚开始使用WiX,但不幸的是,我马上遇到了问题。
因此,我想将默认安装位置设置为“ C:\ Program Files(x86)\ vendor \ App`”,但是我只设法设置为“ C:\ Program Files(x86)\ App`” ...我找不到任何相关的东西...
无论如何,这是“ Product.wxs”代码:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><?define ProjectManagementNF_TargetDir=$(var.ProjectManagementNF.TargetDir)?>
<Product Id="*" Name="AppName" Language="1033" Version="0.1.4.0" Manufacturer="vendor" UpgradeCode="1f380795-2f0d-47fc-9950-9ab74ed5c1d9">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="AppName" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProgramFilesFolder_files" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="App"/>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
<!-- Todo: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent">
// some registry stuff...
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="ProgramFilesFolder_files" Directory="ProgramFilesFolder">
// some stuff..
</ComponentGroup>
</Fragment>
</Wix>
任何帮助,我们都会感激的,
预先感谢!
解决方法
请尝试使用供应商文件夹扩展目录部分,如下所示:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="Vendor" Name="VendorName">
<Directory Id="INSTALLDIR" Name="App">
<!-- Sample component -->
<Component Feature="ProductFeature">
<File Source="C:\Windows\notepad.exe" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
我希望避免使用小型WiX软件包的<Fragment>
部分。在此处查看此示例:https://github.com/glytzhkof/all/blob/master/WiXBitnessX64/WiXBitnessX64/Product.wxs
您可以将所有标记保留在单个<WiX>
和<Product>
元素中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。