需要 C# 程序集来松散引用强命名程序集
所以问题就在这里。我正在编写一些 StyleCop 插件程序集,供我工作的公司使用。因此,这些程序集需要引用强命名的 Microsoft.StyleCop.CSharp.dll。
问题在于,如果我构建这个并将其传递给我组中的开发人员,他们必须具有相同版本的 StyleCop dll(当前为 4.3.3.0),否则无法加载。
使我的附加规则 DLL 更加独立的最佳方法是什么?我是否应该在 GAC 中安装这些从属 StyleCop dll 的 4.3.3.0 版本?程序集(相对于应用程序)可以使用策略文件吗?
哦,主要问题之一是我希望它能够与客户端安装的任何版本的 StyleCop(或至少 4.3.3.0 或更高版本)一起使用(如果可能的话)。
非常感谢。
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.
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.
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?
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.
Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您应该为其他开发人员安装相同的版本。如果不这样做,您可能会因 StyleCop 内的更改而出现不可预测的运行时故障。想必这就是他们费心增加版本号的原因。
如果您不想这样做,可以在 app.config 文件中配置不同的程序集绑定。在配置中,需要您打算在运行时使用的实际版本号。是的,这甚至可以通过政策来完成。但同样,我认为首先包含正确的 DLL 会更好。
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.
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.
在您的项目中,转到 StyleCop 引用的属性。尝试将“特定版本”属性设置为 false。
In your project, go to the properties on the StyleCop reference. Try setting the "Specific Version" property to false.