c# - 为什么我的引用的复制本地属性被禁用?

标签 c# visual-studio dll

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

Disabled Copy Local property

通常我的 VB.NET 项目在项目名称正下方有一个 My Project 项目,我可以双击它 >> references 并设置 Copy Local 属性,但是我的 C# 控制台应用程序似乎没有这个。

My Project References

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

最佳答案

Directly from this SO post:

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/

相关文章:

c# - 将 CJK 字符粘贴到 RichTextBox 会添加不需要的第二种字体

c++ - 为什么Qt Creator不用.lib和LoadLibrary()也能正确链接dll?

c# - asp.net中调度任务的方法(不用写windows scheduler)

c# - 图片上传和图片 slider

wpf - VS2019更新18.2缺少 "WPF App .NET Core"项目模板

javascript - 单击按钮在此 ASP.net Web 表单上调用 javascript 函数?

c++ - 在 Win32 DLL 项目中是否有 'AssemblyInfo.cs' 的等价物?

c# - 使用安全模式从 dll 中获取 char**(作为 (IntPtr) 参数传递给函数)

c# - 如何从外部类库(通过 NuGet 包)引用 UserControl?

c# - 如何通过 C/C++/C# 项目解析并将所有包/类/方法写入数据库?