.Net assemblies interview question

13. What is the significance of the Strong Name tool?

The Strong Name utility (sn.exe) helps in creating unique public-private key pair files that are called strong name files and signing assemblies with them. It also allows key management, signature generation, and signature verification.

14. How can different versions of private assemblies be used in the same application without a re-build?

You can use different versions of private assemblies in the same application without a re-build by specifying the assembly version in the AssemblyInfo.cs or AssemblyInfo.vb file.

15. What is Global Assembly Cache (GAC) ?

GAC is a central repository (cache) in a system in which assemblies are registered to share among various applications that execute on local or remote machines. .NET Framework provides the GAC tool (gacutil.exe utility), which is used to view and change the content of GAC of a system. Adding new assemblies to GAC and removing assemblies from GAC are some of the tasks that can be performed by using the gacutil.exe utility. GAC can contain multiple versions of the same .NET assembly. CLR checks GAC for a requested assembly before using information of configuration files.

The gacutil.exe /i <assembly name> – is the command that is used to install an assembly in GAC. Users use the Command Prompt of Visual Studio to install an assembly in GAC by using this command.

You can see all the assemblies installed in the GAC using the GAC viewer, which is located at the <WinDrive>:<WinDir>\assembly directory, where <WinDir> is windows in Windows XP or windows in Windows Vista or WinNT in Windows 2000. Apart from the list of assemblies, the assembly viewer also shows relevant information, such as the global assembly name, version, culture, and the public key token.

16. Where is the information regarding the version of the assembly stored?

Information for the version of assembly is stored inside the assembly manifest.

17. Discuss the concept of strong names.

Whenever, an assembly is deployed in GAC to make it shared, a strong name needs to be assigned to it for its unique identification. A strong name contains an assembly’s complete identity – the assembly name, version number, and culture information of an assembly. A public key and a digital signature, generated over the assembly, are also contained in a strong name. A strong name makes an assembly identical in GAC.

18. What is the difference between .EXE and .DLL files?

EXE
It is an executable file, which can be run independently.
EXE is an out-process component, which means that it runs in a separate process.
It cannot be reused in an application.
It has a main function.

DLL
It is Dynamic Link Library that is used as a part of EXE or other DLLs. It cannot be run independently.
It runs in the application process memory, so it is called as in-process component.
It can be reused in an application.
It does not have a main function.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top