我遇到一些现有安装程序的问题,我在一个简单的测试用例中重复如下:
忘记我现有的问题并想象我是从头开始,你会建议我构建我的WiX项目来应对这种情况?在我的例子中,所有的库都被定义为合并模块 - 我无法改变它(wixlibs是不可能的)。
我已尝试使用Dependency元素在LibraryA(v2)合并模块和LibraryB合并模块之间创建依赖关系 - 它似乎只是在忘记引用LibraryB时发出链接器警告安装程序,而不是创建实际的依赖项。
我的测试用例中的.wxs脚本看起来像这样(它们都安装在同一个文件夹中以便于测试):
LibraryA的(V1).wxs:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder">
<Component Id="LibraryAComponent" Guid="d98dd742-c3d3-4aee-8d84-87f2b3c837dc">
<File Source="v1\LibraryA.dll" />
</Component>
</Directory>
</Directory>
LibraryA的(V2).wxs:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder">
<Component Id="LibraryAComponent" Guid="d98dd742-c3d3-4aee-8d84-87f2b3c837dc">
<File Source="v2\LibraryA.dll" />
</Component>
</Directory>
</Directory>
<Dependency RequiredId="LibraryBMergeModule.DD524F28_EAE0_47B8_A895_3AF2F7A7361A" RequiredLanguage="1033"/>
LibraryB.wxs:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder">
<Component Id="LibraryBComponent" Guid="46e6e0da-2a99-4f0d-bed2-e764e16b9eed">
<File Source="LibraryB.dll" />
</Component>
</Directory>
</Directory>
App1.wxs:
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" DiskId="1" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="WiXTest" Name="WiXTest">
<Merge Id="LibraryAv1" Language="1033" SourceFile="LibraryAv1.msm" />
<Component Id="App1Component" Guid="93D11AFF-5307-4355-B261-0096775B6A89">
<File Source="App1.exe" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="Libraries" Title="Shared Files" Level="1">
<MergeRef Id="LibraryAv1" />
</Feature>
<Feature Id="App" Title="Application" Level="1">
<ComponentRef Id="App1Component" />
</Feature>
App2.wxs:
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" DiskId="1" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="WiXTest" Name="WiXTest">
<Merge Id="LibraryB" Language="1033" SourceFile="LibraryB.msm" />
<Merge Id="LibraryAv2" Language="1033" SourceFile="LibraryAv2.msm" />
<Component Id="App2Component" Guid="173C71B6-E403-4AC1-894D-06799C6782A4">
<File Source="App2.exe" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="Libraries" Title="Shared Files" Level="1">
<MergeRef Id="LibraryB" />
<MergeRef Id="LibraryAv2" />
</Feature>
<Feature Id="App" Title="Application" Level="1">
<ComponentRef Id="App2Component" />
</Feature>
我猜这是完全错误的做事方式,我正在寻找一些指示让我回到正轨。感觉您需要在Windows Installer中拥有博士才能正确使用WiX。
答案 0 :(得分:0)
我不是WIX专家,但对于MSI,你需要至少一个博士学位。首先,您应该了解有关MSI组件的规则:
从痛苦的经历中我知道,如果有几个MSI引入相同的组件,那就不好了。如果可能的话,我会努力寻求单一来源原则,以便您的libs始终由相同的MSI安装(让它成为基础设施MSI)。您的应用程序MSI然后只需检查基础架构是否已安装,那就是它。
回到你的问题,你应该如何处理合并模块。我会为每个合并模块创建一个额外的msi(是的客户不喜欢拥挤的安装软件目录),以确保如果您需要为库提供服务,您可以完全自由。
我不知道您的软件结构,但可能是您需要同时使用LibraryA v1和v2,因此您应该考虑将库部署到WinSxS缓存,或者是否管理GAC。或者你在文件夹结构或文件名约定中提出了类似的东西。