为什么我的参考的“本地”复制属性被禁用? [英] Why is the Copy Local property for my reference disabled?

查看:246
本文介绍了为什么我的参考的“本地”复制属性被禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将引用的DLL设置为显式复制到我的本地文件夹,但是当我转到此引用的属性时, Copy Local 属性变灰/禁用。

I am trying to set a referenced DLL to be explicitly copied to my local folder however when I go to the properties for this reference, the Copy Local property is grayed out / disabled.

通常我的VB.NET项目有一个我的项目项目直接在项目名称下面,我可以双击>>引用和设置复制本地属性,但是我的C#控制台应用程序似乎没有这个。

Usually my VB.NET projects have a My Project item directly below the project name which I can double-click >> references and set the Copy Local property, however my C# console application does not seem to have this.

我可能配置我的项目不正确吗?对此的任何帮助将不胜感激。

Have I perhaps configured my project incorrectly? Any help on this will be greatly appreciated.

推荐答案

直接从这个SO帖子:


您对Hans回答的评论表明这是一个COM程序集,并且
您正在使用Visual Studio 2010.

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

这意味着程序集引用可能添加了嵌入
Interop Types设置设置为true。这具有将
COM程序集链接到二进制文件中的功能,可以将
完全部署在其中。以下链接有更详细的解释
http:// msdn .microsoft.com / en-us / library / dd409610.aspx 如果您要
要部署它,那么需要执行以下操作•点击
参考标签中的引用•点击F4以弹出
属性网格•将嵌入互操作类型设置为False(这将使ungray
复制本地)•将复制本地设置为true

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 ,在您的情况下, Microsoft.Office.Interop.Excel 。嵌入式互操作类型使COM组件易于部署,因为它将程序集嵌入到程序集中,从而避免了使用应用程序部署Interop程序集的需要。

If you want to copy local, you must set Embed Interop Types to False for the assembly, in your case, Microsoft.Office.Interop.Excel. Embed Interop Types makes deployment easier for COM assemblies in that it embeds the assemblies within your assembly, taking away the need to deploy interop assemblies with the application.

这篇关于为什么我的参考的“本地”复制属性被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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