[英]Why is the Copy Local property for my reference disabled?
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. 我正在尝试将引用的DLL设置为显式复制到我的本地文件夹,但是当我转到此引用的属性时,“
Copy Local
属性将显示为灰色/禁用。
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. 通常我的VB.NET项目在项目名称正下方有一个
My Project
项目,我可以双击>> references并设置Copy Local
属性,但是我的C#控制台应用程序似乎没有这个。
Have I perhaps configured my project incorrectly? 我可能错误地配置了我的项目吗? Any help on this will be greatly appreciated.
任何有关这方面的帮助将不胜感激。
Directly from this SO post: 直接来自这篇SO帖子:
Your comment to Hans answer indicates this is a COM assembly and that you are using Visual Studio 2010.
您对Hans回答的评论表明这是一个COM程序集,您正在使用Visual Studio 2010。
This means the assembly reference was likely added with the "Embed Interop Types" setting set to true.
这意味着可能在“嵌入互操作类型”设置为true时添加了程序集引用。 This has the effect of linking the COM assembly into your binary removing the need to deploy it altogether.
这具有将COM程序集链接到二进制文件的效果,从而无需完全部署它。 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
以下链接有更详细的说明• http://msdn.microsoft.com/en-us/library/dd409610.aspx如果您确实要部署它,那么将需要执行以下操作•单击中的参考引用选项卡•按F4以显示属性网格•将“嵌入互操作类型”设置为False(这将取消对本地复制)•将“复制本地”设置为true
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
设置为False
,在您的情况下为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. 嵌入式互操作类型使COM组件的部署更加容易,因为它将程序集嵌入到程序集中,从而无需在应用程序中部署互操作程序集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.