Click to See Complete Forum and Search --> : Assembly not Appearing in Add Reference Dialog under .NET tab


DelboyDee
November 25th, 2004, 09:20 AM
Hi All,

I have recently created a c# dll which I have applied a strong name to and registered it using GACUtil. If I go to C:\Windows\Assembly it appears in the list without problems. However when in Visual Studio 2003 I create a new application and click on add reference and then select the .NET tab it does not appear??? Is it supposed to appear in there? or do I have to click on browse every time and look for it?

I have also tried regasm.exe to register the class with the system but it still does not do anything in either the .NET or COM tabs.

Any ideas?

Cheers,

Delboy

boudino
November 25th, 2004, 09:58 AM
GAC is intended for searchning for assemblies during runtime, nut during development.

Place you assembly into a common folder on your disk (path).
Than open regedit and navigate to key: HKLM\Software\Microsoft\Visual Studio\7.1\AssembliesFolder\yourAssemblyName and set its Default to the path (only the directory, not the file name.

Where yourAssemblyName is name of your assembly without ".dll" extension. 7.1 may slaightly differ based on you VS version.

I don't know way how to automate this.

darwen
November 25th, 2004, 04:15 PM
True, just to clarify.

Just because an assembly is in the GAC doesn't mean it appears in the .NET references list.

The reason for this is that the GAC isn't quite the same as the registry when considering COM objects.

It should only be used when necessary - as is stated by Microsoft (I can't remember the page in MSDN where I read this, but I do remember reading it).

That said, you can still add .NET assembly references by using the 'browse' button.

The preferred method, if this is an assembly which you've got access to the project and the source code, is to add the PROJECT to the solution.

You do this by right-clicking on the solution in solution explorer and selecting 'add ..' whatever - I can't remember exactly but a good example of this is in my article

http://www.codeguru.com/Csharp/.NET/net_general/assemblies/article.php/c8433/

You will then get an additional tab on your main projects 'add reference' page - 'projects'. You can select the project and then it's plain sailing from that point onwards.

Bear in mind if you're running VS professional this isn't a problem as you have all the languages (C++.NET, C# and VB.NET) installed.

However, if like me you're using standard versions then you can only add projects for the languages you have installed. Otherwise you will still have to explicitly browse to the dlls in question.

Darwen.