使用WIX,并试图安装两个相同的组件,一个用于.Net35和其他.Net40.我使用两个单独的组件,但是WIX阻止了项目的编译.
<Directory Id="GAC40" Name="GAC">
<Component Id="MyDllServicesModuleGac40Component" Guid="307675AA-8AEC-473B-A78A-FB362CCEDE2A" Win64="yes">
<File Id="MyDllNet40DllGac" Name="MyDll.dll" KeyPath="yes" Assembly=".net" Source="..\MyDll\bin\Net40\MyDll.dll" />
</Component>
</Directory>
<Directory Id="GAC35" Name="GAC">
<Component Id="MyDllServicesModuleGac35Component" Guid="47E6BD1B-25CD-466D-945E-06DCF0F2A269" Win64="yes">
<File Id="MyDllNet35DllGac" Name="MyDll.dll" KeyPath="yes" Assembly=".net" Source="..\MyDll\bin\Net35\MyDll.dll" />
</Component>
</Directory>
Run Code Online (Sandbox Code Playgroud)
我收到的错误是:
错误29 ICE30:目标文件'MyDll.dll'由SFN系统上的两个不同组件安装在'[TARGETDIR]\GAC \'中:'MyDllServicesModuleGac40Component.DDD7D974_FE9C_4BA3_BDD3_A1A3A23F8057'和'MyDllServicesModuleGac35Component.DDD7D974_FE9C_4BA3_BDD3_A1A3A23F8057'.这会破坏组件引用计数.D:\ PROJECTS\MyDll.Experimental.3.0.0\Project\MyDll\MyDll.Wix.Services\MergeModule.wxs 34 1 MyDll.Wix.Services
安装程序应该能够检测到.Net35 dll是否安装到C:\ Windows\assembly的GAC,而.Net40 dll安装到C:\ Windows\Microsoft.NET\assembly的GAC.
重命名DLL不是一个选项.
谢谢!
UPDATE
当然,我在发布后想出了一个解决方案,似乎将组件包装在其他元素中,这让我可以使用它.后来我读了Tom Blodget的帖子,这是正确的.
<Directory Id="GAC1" Name="GAC">
<Directory Id="GAC40" Name="GAC">
<Component Id="MyDllServicesModuleGac40Component" Guid="307675AA-8AEC-473B-A78A-FB362CCEDE2A" Win64="yes">
<File Id="MyDllNet40DllGac" Name="MyDll.dll" KeyPath="yes" Assembly=".net" Source="..\MyDll\bin\Net40\MyDll.dll" />
</Component>
</Directory>
</Directory>
<Directory Id="GAC2">
<Directory Id="GAC35" Name="GAC">
<Component Id="MyDllServicesModuleGac35Component" Guid="FD74504A-6FE9-488E-9086-9DAD3024B35D" Win64="yes">
<File Id="MyDllNet35DllGac" Name="MyDll.dll" KeyPath="yes" Assembly=".net" Source="..\MyDll\bin\Net35\MyDll.dll" />
</Component>
</Directory>
</Directory>
Run Code Online (Sandbox Code Playgroud)
好吧,希望它可以帮到某人!
正如Aaron Stebner所解释的那样,
当您对WiX中的文件使用属性Assembly =".net"时,它将在此组件的MsiAssembly和MsiAssemblyName表中创建条目,并将其标记为GAC组件.这意味着该文件将仅由该组件安装到GAC,并且不会安装到该组件所属的目录中.该目录仅供Windows Installer用于在创建管理安装点时暂存该文件的副本.
因此,两个组件的目录必须不同,因为文件名是相同的.如果这些目录没有其他目标,则甚至不会创建它们.我把我的GAC组件放在我的安装文件夹的子目录中:
<Directory Id="tmp_to_GAC" Name="tmp_to_GAC">
Run Code Online (Sandbox Code Playgroud)
每个GAC都需要一个.