.Net MSI/安装项目能否将程序集添加到 .NET Framework GAC 的版本 2 和版本 4 中?
是否可以创建一个 .Net MSI/安装项目,将程序集“X”添加到 .NET 框架 GAC 的版本 2 和版本 4 中?
我尝试将 2 个项目的输出添加到 GAC 特殊文件夹中,例如:
“XTargetingV3.5.csproj” “XTargetingV4”.csproj”
但是,我得到以下可以理解的信息:
警告:两个或多个对象具有相同的目标位置 ('[gac]X\1.0.0.0_2752785e627d5953\X.dll') 警告:两个或多个对象具有相同的目标位置('[gac]X\1.0.0.0_2752785e627d5953\X.dll')
如果我尝试添加包含针对其中一个框架的“X”的合并模块,也会发生这种情况。
我希望针对 .Net 框架 v3.5 构建的现有客户端应用程序(因此在 C:\Windows\Assembly 中查找“X”)继续使用此 GAC,而针对目标构建的新客户端.Net 框架 v4 还将通过查找新的 GAC (C:\Windows\Microsoft.NET\ assembly) 来找到“X”。因此,当更新“X”时,MSI 安装程序会将“X”安装到两个 GAC,以便 v3.5 客户端和 v4 客户端将获得更新。
我知道我可以请求旧的 v3.5 客户端改用 v4 运行时(请参阅 将程序集版本重定向到不同的 CLR/GAC) 使用:
<configuration>
<startup>
<supportedRuntime version="v4.0" />
</startup>
</configuration>
但我试图避免为现有客户端创建 app.configs。
Is it possible to create a .Net MSI/setup project which can add an assembly “X” to both version 2 and version 4 of the .NET framework GAC?
I have tried by adding the output from 2 projects to the GAC special folder, e.g.:
“XTargetingV3.5.csproj”
“XTargetingV4”.csproj”
However, I get the following which is understandable:
WARNING: Two or more objects have the same target location ('[gac]X\1.0.0.0_2752785e627d5953\X.dll')
WARNING: Two or more objects have the same target location ('[gac]X\1.0.0.0_2752785e627d5953\X.dll')
This also happens if I try to add a merge module containing “X” targeting one of the frameworks.
I would like my existing client application which was built to target v3.5 of the .Net framework, (hence looks in C:\Windows\Assembly for “X”), to continue to use this GAC, whereas new clients built to target v4 of the .Net framework will also find “X” by looking in the new GAC (C:\Windows\Microsoft.NET\assembly). Therefore when “X” is updated, the MSI installer will install “X” to both GACs so v3.5 clients and v4 clients will get the update.
I understand that I can request the old v3.5 client to use v4 of the runtime instead (see Redirecting Assembly versions to a different CLR/GAC) using:
<configuration>
<startup>
<supportedRuntime version="v4.0" />
</startup>
</configuration>
but I am trying to avoid creating app.configs for existing clients.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Framework 4 GAC 在 GAC 目录内有一个子文件夹。使用 gacutil 查看路径。
Framework 4 GAC has a sub folder inside the GAC directory. Use gacutil to see the path.