【发布时间】:2019-01-15 16:25:19
【问题描述】:
我正在为具有许多依赖项的 .NET 项目创建一个 wix 安装程序。目前,我有一个可用的 .msi 安装程序,但正如预期的那样,所有依赖项 .dll(以及资源文件夹)都放在与已安装应用程序相同的目录中,而不是与其捆绑在一起。
阅读WIX Bundle Creation 的答案,似乎可以将我的产品原样保留在一个文件中,并在另一个文件中包含引用该产品的捆绑包,但我似乎找不到任何示例。
有没有简单的方法来做到这一点?我在下面包含了产品代码的概要。
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:ui="http://schemas.microsoft.com/wix/UIExtension">
<Product Id="*" Name="#####" Language="1033" Version="1.0.0.0" Manufacturer="..." UpgradeCode="...">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" />
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="alphaInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProductMenuComponents" />
<ComponentGroupRef Id="DependencyComponents"/>
<ComponentGroupRef Id="ResourcesComponents"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenu64Folder">
...
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="CMP_alphaGUISetup" Win64="yes">
<File Id="FILE_alphaGUIApplication.exe" Source="$(var.alphaGUI.TargetPath)" KeyPath="yes"></File>
</Component>
</ComponentGroup>
<ComponentGroup Id="ProductMenuComponents" Directory="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="..." >
<Shortcut .../>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue .../>
</Component>
</ComponentGroup>
<ComponentGroup Id="DependencyComponents" Directory="INSTALLFOLDER" Source=...>
<Component Id="log4net">
<File Name="log4net.dll" />
</Component>
...
</ComponentGroup>
<ComponentGroup Id="ResourcesComponents" Directory="ResourcesFolder" Source=...>
<Component Id="logo.ico">
...
</ComponentGroup>
</Fragment>
</Wix>
【问题讨论】:
-
所以您现在有一个 MSI,但是作为 MSI 一部分的文件没有打包到一个文件中 - 这是您要解决的问题吗?
-
@Isaiah4110 是的,完全正确。如果最终捆绑包不是 MSI 而是 EXE 或类似的东西,也可以。
-
如果以下建议有效,请告诉我。
-
嗨 Theo,稍微更新了我的答案。没有什么革命性的。