The Problem
You install a .NET redistributable package and want to reference the assemblies in your project. However, though everything is correctly installed to GAC, the assemblies don’t show up in Visual Studio’s Add Reference dialog in the .NET tab (regardless of what version of Visual Studio you have).

The Cause
Redistributable assemblies are intended for runtime. They are assemblies that have to be deployed on a target machine, so that applications needing them run correctly on other machines than the development machines. They are installed in GAC, but that is not enough for Visual Studio to pick them up and display them in the Add Reference dialog, in the .NET assemblies tab. Actually Visual Studio scans a set of folders that is specified in Registry and that’s why your redistributables are not showing up.

The Solution
The solution is fairly simple. Basically you have to do two things:

  • first, you should make a copy of the assemblies to another folder
  • second, you have to add that folder in Registry where Visual Studio keeps its list of folders with references. The path differs on 32-bit and 64-bit machines, but the details are specified in this article How to: Add or Remove References in Visual Studio.

Example
I will demonstrate the fix using the ReportViewer redistributable assemblies. I have several versions of Visual Studio installed on my machine: 2008, 2010 and 2012. I also have three versions of the ReportViewer control 9.0 (2008), 10.0 (2010) and 11.0 (2012), but also installed the redistributables for version 8.0 (2005). However, only the first three appear in Add References dialog in Visual Studio.

Add References dialog

Yet, all versions are present in GAC:

ReportViewer in GAC

I noticed that all other versions are installed under C:\Program Files (x86)\Microsoft Visual Studio xx\ReportViewer (where xx is the version). Since I already had a folder with some files for Visual Studio 2005, I created another folder there called ReportViewer.

In Registry, I looked for the key where the other versions are specified.

I added a new key called Report Viewer 8, and set the default value to the path of the folder that I created.

After re-opening the Add References dialog (no need to restart Visual Studio), the new assemblies shown up.

, , , , Hits for this post: 10804 .
Trackback

only 1 comment untill now

  1. Gravatar

    [...] 5. Why won’t my .NET redistributable assemblies show up in Visual Studio’s ‘Add Reference’ dial… [...]

Add your comment now