Microsoft.mshtml.dll再分配问题 [英] Microsoft.mshtml.dll redistribution issues

查看:167
本文介绍了Microsoft.mshtml.dll再分配问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经被内部使用Microsoft.mshtml.dll一个C#BHO。现在打包这个BHO我是否需要同时经销Microsoft.mshtml.dll。它是细到我的dll添加这个dll?任何法律问题?这BHO适用于开发环境优良的Microsoft.mshtml.dll出现在Visual Studio(C:\Windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\Microsoft.mshtml.dll)猜测,这会不会每一台机器上的情况。请建议。

I have made a C# BHO which is using Microsoft.mshtml.dll internally. Now to package this BHO do i need to also distribute Microsoft.mshtml.dll. Is it fine to add this dll with my dlls? Any legal issue ? This BHO works fine on dev environment as the Microsoft.mshtml.dll is present in visual studio (C:\Windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\Microsoft.mshtml.dll) guess, which will not the case on each machine. Please suggest.

推荐答案

这是一个互操作程序集,它不包含任何代码。刚刚宣布,从COM类型库自动生成的。摇匀因此罚款。它安装在GAC在所有的唯一原因是因为它是一个PIA,主互操作程序集。当你写一个类库,公开任何界面在自己的公共方法,你只需要一个PIA。这样的库的客户端也需要互操作集的引用,以便能够使用你的方法,它一定是你使用完全相同的之一。这是一般罕见的,尤其是在一个BHO。

It is an interop assembly, it doesn't contain any code. Just declarations, auto-generated from the COM type library. Redistributing is thus fine. The only reason it is installed in the GAC at all is because it is a PIA, a primary interop assembly. You only need a PIA when you write a class library that exposes any of the interfaces in your own public methods. The client of such a library also needs a reference to the interop assembly to be able to use your methods and it must be the exact same one you use. This is rare in general, especially in a BHO.

如果您使用之前,VS2010一个Visual Studio版本,则只需设置复制本地属性为True作为组件参照。重建,你会得到你可以随你自己的可执行文件部署DLL的一个副本。

If you use a Visual Studio version prior to VS2010 then just set the Copy Local property to True for the assembly reference. Rebuild and you'll get a copy of the DLL that you can deploy along with your own executables.

有关VS2010及以上,你真的想青睐嵌入互操作类型特征。它嵌入在自己组装的接口声明,只有你真正使用的人。其中帮了不少忙,让您的BHO小的分配大小。而且避免了需要部署互操作程序集。强烈推荐。

For VS2010 and up, you really want to favor the Embed Interop Type feature. Which embeds the interface declarations in your own assembly, only the ones you actually use. Which helps a great deal to keep the distributable size of your BHO smaller. And avoids the need to deploy that interop assembly. Strongly recommended.

这篇关于Microsoft.mshtml.dll再分配问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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