How to copy dll from gac to a folder

Views: 314
Created Date: 26-Sep-2016

DLLs once deployed in GAC (normally located at c:\windows\assembly) can’t be viewed or used as a normal DLL file. They can’t be directly referenced from VS project. Developers usually keep a copy of the original DLL file and refer to it in the project at development (design) time, which uses the assembly from GAC during run-time of the project.


During execution (run-time) if the assembly is found to be signed and deployed in GAC the CLR automatically picks up the assembly from the GAC instead of the DLL referenced during design time in VS. In case the developer has deleted the original DLL or don’t have it for some reason, there is a way to get the DLL file from GAC. Follow the following steps to copy DLL from GAC


1. Run regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll – shfusion.dll is an explorer extension DLL that gives a distinct look to the GAC folder. Unregistering this file will remove the assembly cache viewer and the GAC folder will be then visible as any normal folder in explorer. 


2. Open “%windir%\assembly\GAC_MSIL”.


3. Browse to your DLL folder into the deep to find your DLL.


4. Copy the DLL somewhere on your hard disk and refer it from there in your project


5.    Run “regsvr32 /i %windir%\Microsoft.NET\Framework\<.NET version directory> \shfusion.dll” to re-register the shfusion.dll file and regain the original distinct view of the GAC.


References – for additional information on assembly cache viewer (shfusion.dll)

Similar Tags
4.0 3