gpt4 book ai didi

WIX 将两个程序集部署到 GAC

转载 作者:行者123 更新时间:2023-12-02 07:35:20 26 4
gpt4 key购买 nike

使用 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>

我收到的错误是:

Error 29 ICE30: The target file 'MyDll.dll' is installed in '[TARGETDIR]\GAC\' by two different components on an SFN system: 'MyDllServicesModuleGac40Component.DDD7D974_FE9C_4BA3_BDD3_A1A3A23F8057' and 'MyDllServicesModuleGac35Component.DDD7D974_FE9C_4BA3_BDD3_A1A3A23F8057'. This breaks component reference counting. D:\PROJECTS\MyDll.Experimental.3.0.0\Project\MyDll\MyDll.Wix.Services\MergeModule.wxs 34 1 MyDll.Wix.Services

安装程序应该能够检测到 .Net35 dll 安装到 GAC 的 C:\Windows\assembly,而 .Net40 dll 安装到 GAC 的 C:\Windows\Microsoft.NET\assembly。

重命名 DLL 不是一种选择。

谢谢!

更新

我在发布后自然想出了一个解决方案,似乎将组件包装在其他元素中让我可以让它工作。后来我阅读了 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>

嗯,希望对某人有所帮助!

最佳答案

正如 Aaron Stebner 所解释的那样,

When you use the attribute Assembly=".net" for a file in WiX, it will create entries in the MsiAssembly and MsiAssemblyName table for this component and mark it as a GAC component. That means that the file will only be installed to the GAC by this component, and it will not install to the directory that the component is a child of. That directory will only be used by Windows Installer to stage a copy of that file when creating an administrative install point.

因此,两个组件的目录必须不同,因为文件名相同。如果这些目录没有其他目标,它们甚至不会被创建。我将 GAC 组件放在安装文件夹的子目录下:

<Directory Id="tmp_to_GAC" Name="tmp_to_GAC"> 

每个 GAC 都需要一个。

关于WIX 将两个程序集部署到 GAC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17090689/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com