Vadim's Weblog

Never stop learning.

How to display your assembly “Add References” dialog.

Posted by Vadim on July 11, 2010

In Ultimate Software (the company that I work for) we build all the assemblies in the same directory.  Let say it’s C:\Common.  When we need to reference an assembly, we browse to C:\Common directory and select a desired assembly.

I decided to look what we need to do to add our assemblies into .NET tab of “Add Reference” dialog box.  It’s quite simple actually.  All we need to do is to create a registry entry.

First lets assume that we want to reference AssemblyReference.dll that located in C:\Common directory.  It’s probably not going to surprise anybody if I tell you that you’ll not find it in “.NET” tab of Add Reference dialog.

.NetReference

As you can see it’s not there at the moment.  However, if we chose a “Browse” tab and navigate to C:\Common directory will be able to find it.

BrowseReference

I just want to point out that adding an assembly to GAC will not add that assembly to the .NET tab’s list.   It’s also not a good practice to install an assembly to the Global Assembly Cache, unless you want to share that assembly with other applications running on that computer. 

Therefore only thing we need to do add our assembly to .NET tab’s list is to create a unique sub-key under

HKLM\SOFTWARE\Microsoft\.NETFramework\.NETMinimumVersion\AssemblyFoldersEx\

If you’re running a 64-bit OS you will need to create it under:

HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\.NETMinimumVersion\AssemblyFoldersEx\

.NETMinimumVersion is the lowest .NET Framework version from which the assembly can be referenced.  In our example I chose version 2.0.50727 as you can see below.

After creating a new sub-key, we’ll change its default string value to the “C:\Common\” directory path.

RegistryReference

After restarting Visual Studio 2010, we can find our AssemblyReference assembly in .NET tab’s list of Add Reference dialog.

.NetAssemblyRef

In our example we added the sub-key under HKEY_LOCAL_MACHINE node that allows all the users on this system to see AssemblyReference.dll.  If we wanted only the current user to see this assembly, we would create our sub-key under HKEY_CURRENT_USER instead.

Note for VS 2008 and earlier:

For Visual Studio 2008 and earlier you need to add your sub-key under

HKLM\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\

kick it on DotNetKicks.com

About these ads

2 Responses to “How to display your assembly “Add References” dialog.”

  1. asp.net, c#,javascript…

    […]How to display your assembly “Add References” dialog. « Vadim's Weblog[…]…

  2. Yes! Finally something about work from.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: