Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include GAC Assemblies in Bin

Any ideas how to force a GAC DLL into referenced?

Here is my issue, I constantly use a 3rd party DLL that registers itself into the GAC, and when I use it in my project, it reads it from the gac, and when I deploy, I'm always forgetting to add the DLLs since it is not located in the Bin/Referenced folder.

Anyway to force Visual Studio to add the DLL instead of from GAC?

like image 816
jaekie Avatar asked Apr 27 '10 17:04

jaekie


People also ask

Where are GAC dlls stored?

It is located in %windir%\assembly (for example, C:\WINDOWS\assembly) and it is a shared repository of libraries.

Why would I avoid the GAC?

Why would I avoid the GAC? The GAC should contain “global” shared assemblies only, so there are many instances when you would NOT install an assembly in the GAC: The assembly is private to your application and not to be shared with other applications. You want to use XCOPY or FTP copy to install a .


4 Answers

Copy Local only works if the GAC'd assembly if one reference level deep. For instance, if you have a project that references the GAC'd assembly, and that project if referenced by your web project, then while yes, the GAC'd assembly will be copied to the first project's bin folder, but it won't be copied to your web project's bin folder.

The solution, then, is to directly set a reference in the web project to the GAC'd assembly, and specify Copy Local. Even though the web project doesn't directly use the reference in this case, it will copy it to the web application's bin folder.

like image 184
Jason C Avatar answered Oct 13 '22 20:10

Jason C


Right click on the assembly reference, select properties, and change "Copy Local" to true. That will cause it to copy the assembly into the deployment directory

like image 34
Joel Martinez Avatar answered Oct 13 '22 19:10

Joel Martinez


Select the dll in your references and set CopyLocal=true in the properties window.

like image 36
Fergal Moran Avatar answered Oct 13 '22 21:10

Fergal Moran


Select the reference and set the Copy Local property to True

like image 2
Daniel Renshaw Avatar answered Oct 13 '22 20:10

Daniel Renshaw