为什么.net中引用dll文件属性窗口中的“复制到本地”属性不可用(Why is the Copy Local property for my reference disabled?)

来源:互联网 发布:大学生网络责任感 编辑:程序博客网 时间:2024/04/20 23:38

原文地址:

http://stackoverflow.com/questions/15526491/why-is-the-copy-local-property-for-my-reference-disabled


总结:

在dll文件属性窗口中查看他的“签入互操作类型(Embed Interop Types)”属性是否被设置成true,如果是,

则改为false;

这时再看“复制到本地(Copy Local)”属性就会变为可用;


====

Your comment to Hans answer indicates this is a COM assembly and that you are using Visual Studio 2010.

This means the assembly reference was likely added with the "Embed Interop Types" setting set to true. This has the effect of linking the COM assembly into your binary removing the need to deploy it altogether. The following link has a more detailed explanation •http://msdn.microsoft.com/en-us/library/dd409610.aspx If you do want to deploy it though then will need to do the following •Click on the reference in the references tab •Hit F4 to bring up the properties grid •Set "Embed Interop Types" to False (this will ungray Copy Local) •Set "Copy Local" to true

注意:

在将“签入互操作类型”变为false后,程序执行上要比以前要明显感觉到慢,所以在具体引用很多com的应用中,要注意。

0 0