如何在Visual Studio参考管理器中并行安装.NET4.0,.NET4.5,x86,AnyCPU DLL [英] How to install .NET4.0, .NET4.5, x86, AnyCPU DLLs side by side in Visual Studio Reference Manager

查看:167
本文介绍了如何在Visual Studio参考管理器中并行安装.NET4.0,.NET4.5,x86,AnyCPU DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题在这里,我试图创建一个安装程序,在目标用户的PC上安装DLL,并使它们可用于Visual Studio参考管理器(项目>添加引用)

Related to this question here, I am trying to create an installer which installs DLLs on the target user's PC and makes them available to the Visual Studio Reference Manager (Project > Add References)

我已经弄清楚,为了使一个程序集可以看到.NET4.0参考管理器,我需要添加这个注册表项

I have figured out that to make an assembly visible to the .NET4.0 Reference Manager, I need to add this Registry Key

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\MyAsm
Value: <Directory on target PC of .NET4.0 assembly>

而对于.NET4.5,我需要这个键

And for .NET4.5, I need this key

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\MyAsm
Value: <Directory on target PC of .NET4.5 assembly>

然而,我现在有一个问题。当我去添加引用时,我看到这样的东西

However I now have a problem. When I go to Add-References, I see something like this

所以我的问题是,这里最好的做法是将多个DLL编译到不同的.NET Frameworks(例如.NET4.0 ,.NET4.0客户端配置文件,.NET4.5),并针对不同的计算机(x86,x64,AnyCPU),以便只有一个版本显示在添加引用中或者可以在添加引用对话框中区分版本? / p>

So my question is, what is the best practice here for distributing multiple DLLs compiled to different .NET Frameworks (e.g. .NET4.0, .NET4.0 Client Profile, .NET4.5) and targeting different machines (x86, x64, AnyCPU) so that only one version shows up in Add-References OR So that versions can be differentiated in the Add-References dialog?

推荐答案

一般来说,最佳做法是不要弄乱用户的注册表。请注意,程序员不会期望在框架列表中找到一个非Microsoft程序集,所以甚至可能看不到。增加的便利性是相当小的,用户可以简单地使用浏览按钮来选择您复制到他的机器上的参考程序集。尽管你确实需要向他提供一个提示,看看哪里。当您使用标准c:\program files\company\product命名策略时,不是很大的问题。

In general the best practice is to not mess with the user's registry. Do note that a programmer won't expect to find a non-Microsoft assembly in the Framework list so might never even look there. The added convenience is fairly minor, the user can simply use the Browse button to pick the reference assembly you copied onto his machine. Albeit that you do need to provide him with a hint on where to look. Not much of a problem when you use the standard c:\program files\company\product naming strategy.

避免重复,否则容易。如果您的程序集与.NET 4.0兼容,那么只需修改v4.0.30319键。目标4.5的项目将包括列表中的4.0个程序集。如果您因某些原因需要4.5,请修改v4.5.50709密钥。

Avoiding the duplicate is otherwise easy. If your assembly is compatible with .NET 4.0 then only modify the v4.0.30319 key. A project that targets 4.5 will include 4.0 assemblies in the list. If you require 4.5 for some reason then modify the v4.5.50709 key.

这篇关于如何在Visual Studio参考管理器中并行安装.NET4.0,.NET4.5,x86,AnyCPU DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆