Showing posts with label GAC. Show all posts
Showing posts with label GAC. Show all posts

Monday, 7 November 2011

If we have two version of same assembly in GAC how do we make a choice ?

OK first let’s try to understand what the interviewer is talking about. Let’s say you have made an application and its using a DLL which is present in GAC. Now for some reason you make second version of the same DLL and put it in GAC. Now which DLL does the application refer? Ok by default it always uses the version by which you have compiled you application in IDE. But you want that it should actually use the older version.

So first we answer in short. You need to specify “bindingRedirect” in your config file. For instance in the below case “ClassLibraryVersion” has two versions “1.1.1830.10493” and “1.0.1830.10461” from

Sunday, 23 October 2011

How to add and remove an assembly from GAC?

There are two ways to install .NET assembly in GAC:-

  • Using Microsoft Installer Package. You can get download of installer from http://www.microsoft.com.

  • Using Gacutil. Goto “Visual Studio Command Prompt” and type “gacutil –i (assembly_name)”, where (assembly_name) is the DLL name of the project.


 

Friday, 21 October 2011

What is GAC in DotNet?

What are situations when you register .NET assembly in GAC ?

GAC (Global Assembly Cache) is used where shared .NET assembly reside. GAC is used in the following situations :-

  • If the application has to be shared among several application.

  • If the assembly has some special security requirements like only administrators can remove the assembly. If the assembly is private then a simple delete of assembly the