Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio copy dll references to output folder

I am trying to extend a certain application. I am using a DLL which comes bundled with that application to extend its functionality. I am using visual studio 2010 express edition. I added a reference to the dll library. In the reference properties the option "Copy local" is disabled.(greyed out) why is that? I want visual studio to copy the dll to my release folder. If this can't be done is there another way to bundle the dll?

like image 813
user434541 Avatar asked Sep 03 '10 12:09

user434541


Video Answer


2 Answers

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
like image 192
JaredPar Avatar answered Sep 20 '22 03:09

JaredPar


It depends on what kind of DLL it is. If it is a COM server then Copy Local is off when you have a PIA registered for that COM server. If it is a regular .NET assembly then it will be off when it is registered in the GAC.

Fix the issue by, respectively, using regasm /u to unregister the PIA or gacutil /u to remove it from the GAC. Do note that you might not want to do this if this DLL requires that its installer is executed on the target machine. Which is likely. Talk to the component vendor or author to find out what you should do.

like image 25
Hans Passant Avatar answered Sep 22 '22 03:09

Hans Passant