Why is the Copy Local property for my reference di

2019-02-02 04:57发布

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.

Disabled Copy Local property

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.

My Project References

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

1条回答
Evening l夕情丶
2楼-- · 2019-02-02 05:52

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

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.

查看更多
登录 后发表回答