Why is the Copy Local property for my reference disabled?

后端 未结 1 492
别跟我提以往
别跟我提以往 2020-12-24 04:51

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 i

相关标签:
1条回答
  • 2020-12-24 05:29

    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.

    0 讨论(0)
提交回复
热议问题