?
Solved

Global Assembly Cache

Posted on 2004-03-21
3
Medium Priority
?
349 Views
Last Modified: 2012-05-04
Hi,

I have created 2 versions of a dll (mydll.dll) and I have registered into the Global Assembly Cache. I registered this using the tool mscorcfg.msc. I created 2 console applications say (A & B). I want Application A to call one version of mydll and the Application B to call the second version. Is there a way to do this programmatically and not using any tool like mscorcfg.msc?


Usha
0
Comment
Question by:ushakv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
eric_duncan earned 80 total points
ID: 10691897
Sure. In fact, you didn't even have to register your .dlls in the GAC to manage the two versions, simply assigning them a strong name works as well.

To start with, in order to add a reference to the assemblies you will need to have them both installed somewhere on your machine so you can browse to them in the Add References... dialog box. Even though you've placed them in the GAC, Microsoft doesn't give you a good way to get to them.

Next, add a reference to the specific version of the assembly you need in each application via the Add References... dialog box. Even though you'll be browsing to a directory in the local filesystem, the IDE is smart enough to figure out that you also have the same version of the .dll in the GAC so it will set the application up to use that file. To verify this, you can view the properties of the reference in the IDE and check that the Copy Local property is set to 'False'.

Since each assembly has a strong name, .Net will automatically bind to the specific version of the assembly. So if you later install a newer version of the assembly in the GAC, .Net will still continue to use the older versions until you either recompile with the new reference or redirect the reference using the machine.config or application.config files.

To make it easier to add references to the assemblies in the future, you can also look at this link that tells you how to set up the IDE so that your assemblies will show up in the components list of the Add References dialog so you don't have to browse for them every time.

http://support.microsoft.com/default.aspx?scid=kb;en-us;306149

You can also check these links out that discuss versioning and the GAC in more detail:

http://www.dotnetextreme.com/articles/versioning2.asp

http://weblogs.asp.net/rpooley/archive/2003/11/06/36138.aspx

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconside-by-sideexecutionoverview.asp

I hope that this helps.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question