简体   繁体   English

为什么我的参考的Copy Local属性被禁用?

[英]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.

相关问题 DLL属性复制到本地 - DLL property Copy to local 属性何时会被调用创建引用类型的本地副本? 怎么避免呢? - When will a property get call create a local copy of a reference type? How to avoid that? 参考另一个项目,其中带有“复制本地” - Reference another project with Copy Local on it's reference 在我的参考程序集的Visual Studio 2013中找不到“复制本地”选项 - Cannot find “Copy Local” option in Visual Studio 2013 for my reference assemblies 为什么虽然是引用类型,但使用ThreadLocal的Value成员的本地副本的速度更快? - Why is working with a local copy of ThreadLocal's Value member faster although it is a reference type? 该属性是引用还是副本,在内存中的行为如何? - Is this property a reference or a copy and how it would behave in memory? 如何设置* .dll文件的“复制本地”属性? - How to set “Copy Local” property of a *.dll file? 为什么我的某些按钮在运行时被禁用? - Why are some of my buttons disabled at runtime? 为什么禁用的按钮会改变颜色? - Why are my disabled buttons changing color? 为什么自定义 CompositeControl 的 Enabled 属性在被覆盖时仍然设置 disabled=“disabled”? - Why is the Enabled property of a custom CompositeControl still setting disabled=“disabled” when the property is overridden?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM