[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

Referencing a Class Assembly from GAC using Visual Studio .Net

Hi there,

I am currently building a c# application and have created a seperate class library, which I need to reference from the GAC.

I have given the assembly a strong name and have placed it in the assembly using gacutil and also by draggin the dll into the WINNT/assembly folder.

However when I right click in visual studio.net on reference in my application to add a reference to the assembly I cannot find it in the list.

Can anyone help me? Ive tried rebooting, closing down and re-opening the project.. I also cannot manage to delete the assembly so I can try re-installing it.... Any ideas?


1 Solution
You wouldnt find your custom assemblies (which are placed in the GAC) in the list by default. It requires a Registry Key to appear in the list.
So, You need to browse to the GAC and add it to the project. GAC is in C:\Windows\Assembly folder

You have to follow the steps below

1. Create a strong name for assembly.

2. Install assembly to GAC.

3. Register assembly entry in registry:
 1) Click Start - run, then type regedit to open registry.
 2) Go to HEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\
 3) Right click AssemblyFolders, then select new to create a new key for your assembly(for example:Security)
 4) Select Modify by right clicking Default, then enter the location where your dll resides.

Now, you should be able to see the name of your dll from the reference list when you open a VS project.

I think you have done steps 1 & 2 ,follow the step 3.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now