我有我已經重複一個簡單的測試情況如下一些現有的安裝程序的一個問題:維克斯合併模塊依賴
- Installer1安裝App1和LibraryA的(V1)。
- 安裝程序2安裝App2,LibraryA(v2)和LibraryB。 LibraryA的(V2)需要LibraryB,這就是爲什麼現在安裝LibraryB。 LibraryA(v1)沒有這樣的依賴關係。 LibraryA(v2)應該覆蓋LibraryA(v1)。
- 如果我運行Installer1然後Installer2,然後卸載Installer2,LibraryB被刪除,但LibraryA的保持在V2(明智的 - 我不希望它恢復到以前的版本)。
忘記我現有的問題,想象我從頭開始,你會如何建議我構建我的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安裝程序博士學位,以便正確地使用WiX的。