.Net Interview questions: – Explain GAC, add/remove an assembly from GAC and how do we make choices between 2 versions of the same assembly.

This .NET interview questions will make you remember the basics of .NET if you are senior person in the .NET industry. For the fresher it is still a hiccup so one can start answering the same as follows: –

About GAC: –

GAC (Global Assembly Cache) is where all shared .NET assembly resides. GAC is used in the following situations: –

  • If the application has to be shared among several application which is in the same computer.
  • 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 assembly file will remove the assembly.

Add/remove an assembly from GAC: –

You can use the ‘GACUTIL’ tool which comes with visual studio. So to register an assembly in to GAC go to “Visual Studio Command Prompt” and type “gacutil –i (assembly name)”, where (assembly name) is the DLL name of the project.

One you have installed the assembly the DLL can be seen in ‘c:\windows\assembly\’ folder.

When we have many DLL’s to be deployed we need to create setup and deployment package using windows installer. So the common way of deploying GAC DLL in production is by using windows installer.

Making choice between two versions of the same assembly in GAC: –

When we have two version of the same assembly in GAC we need to use binding redirect tag and specify the version we want to use in the new version property as shown in the below “app.config” file.

<configuration>
<runtime>
<assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
<dependentAssembly>
<assemblyIdentity name=”ComputerName” publicKeyToken=”cfc68d722cd6a164″ />
<publisherPolicy apply=”yes” />
<bindingRedirect oldVersion=”1.1.0.0″ newVersion=”1.0.0.0″ />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Get ready to see more basics videos of .NET interview questions
on Garbage Collector, Gen 0, 1 & 2 as follows: –

Get more fundamentals stuffs on important Dotnet interview questions

Regards,

More from author’s blogs on Most asked Dotnet interview questions for interview references.

Advertisements

About c# and .NET Interview questions

This blog is for developers who want to crack .NET and C# interviews. It has all tips and tricks needed to crack .NET interviews , C# interview , SQL Server interview , Java interview , WCF Interview , Silverlight interview , WPF interview , LINQ interview , Entity framework Interview. Do not forget to watch our Learn step by step video series. Learn MVC in 16 hours:- https://www.youtube.com/watch?v=Lp7nSImO5vk Learn AngularJS Step by Step:- https://www.youtube.com/watch?v=0kmdjqgO9IY Learn Design Pattern in 8 hours:- https://www.youtube.com/watch?v=YDobmucohqk Learn C# and .NET in 60 days:- https://www.youtube.com/watch?v=yh2SrzCkNQA Learn MSBI in 32 hours:- https://www.youtube.com/watch?v=mGPJx3ocFgg Learn SharePoint Step by Step in 8 hours:- https://youtu.be/C2fW76SwJNU
This entry was posted in Uncategorized and tagged , , , , , , , , , . Bookmark the permalink.

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