需要一个C#大会松散引用一个强命名程序集 [英] Need a C# Assembly to reference a strongly named assembly loosely

查看:272
本文介绍了需要一个C#大会松散引用一个强命名程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这里的问题。我在写一些StyleCop插件程序集在我工作的公司使用。因此,这些程序集需要引用Microsoft.StyleCop.CSharp.dll,这是强命名的。

So here's the problem. I'm writing some StyleCop plug-in assemblies for use at the company I work for. As such, these assemblies need to reference Microsoft.StyleCop.CSharp.dll for example, which is strongly named.

问题出现了,如果我构建这个并传递对我的组中的开发人员,他们必须具有相同版本的StyleCop dll(目前为4.3.3.0)或无法加载。

The problem comes in that if I build this and pass it along to the developers in my group, they must have the same version of the StyleCop dll (currently 4.3.3.0) or it fails to load.

什么是最好的方法使我的附加规则DLL更独立?我应该只是安装我的4.3.3.0版本的那些从属StyleCop dlls在GAC?一个程序集(vs一个应用程序)可以使用一个策略文件?

What is the best way to make my add-on rules DLL more independent? Should I just install my 4.3.3.0 version of those subordinate StyleCop dlls in the GAC? Can an assembly (vs an application) use a policy file?

哦,其中一个主要的问题是我想使用任何版本的StyleCop客户端

Oh, and one of the main problems is i would like it to work with ANY version of StyleCop the client has installed (or at least 4.3.3.0 or later) if possible.

提前非常感谢。

推荐答案

是的,你应该只为其他开发人员安装相同的版本。如果不这样做,您可能会因为StyleCop中的更改而出现不可预测的运行时故障。大概这就是为什么他们打扰增加版本号。

Yes you should just install the same version for the other developers. If you do not, you may have unpredictable runtime failures due to changes within StyleCop. Presumably that is why they bothered to increment the version number.

如果你不想这样做,你可以在app.config文件中配置不同的程序集绑定中。在配置中,需要在运行时使用的实际版本号。是的,这甚至可以通过政策。但是,再次,我认为你最好通过包括正确的DLL在第一位。

If you don't want to do this, you can configure a different assembly binding in the app.config file. In the config the actual version number which you intend to use at runtime is needed. And yes, this can even be done via policy. But again, I think you are better served by including the correct DLL in the first place.

这篇关于需要一个C#大会松散引用一个强命名程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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