Add reference to your brand-new assembly in Visual Studio

Today I downloaded FreeImage, and compiled the .Net wrapper project so that I can call the library from my C# project. Instead of referencing the wrapper project, I wanted to reference the assembly that the wrapper project generates.

Two problems to be solved:

  • You can only register an assembly in the GAC if it has a strongname. To create it, either use the sn tool, or active the project setting to generate the key.
  • Even after registering using gacutil, the assembly would not show up in the Add Reference dialog.

There are at least two solutions to the second problem:

  • Create a registry key (HKLM or HKCU) to point to a directory which contains all the assemblies you need to reference (MSKB, VS reference
  • Copy your assemblies to the PublicAssemblies directory located under the VS home directory (described here, replace with actual install directory)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: