我正在尝试将引用的 DLL 设置为显式复制到我的本地文件夹,但是当我转到此引用的属性时,Copy Local
属性显示为灰色/禁用。
通常我的 VB.NET 项目在项目名称正下方有一个 My Project
项目,我可以双击它 >> references 并设置 Copy Local
属性,但是我的 C# 控制台应用程序似乎没有这个。
我的项目配置不正确吗?对此的任何帮助将不胜感激。
最佳答案
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
如果要复制本地,必须将程序集的 Embed Interop Types
设置为 False
,在您的情况下,Microsoft.Office.Interop.Excel
。嵌入互操作类型使 COM 程序集的部署更容易,因为它将程序集嵌入到您的程序集中,消除了使用应用程序部署互操作程序集的需要。
关于c# - 为什么我的引用的复制本地属性被禁用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15526491/