.Net Interview Questions
1. What do you know about .NET assemblies?
Answer:Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET Remoting applications.
2. What’s the difference between private and shared assembly?
Answer:Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.
3. What’s a strong name?
Answer:A strong name includes the name of the assembly, version number, culture identity, and a public key token.
4. How can you tell the application to look for assemblies at the locations other than its own install?
Answer:Use the directive in the XML .config file for a given application.
should do the trick. Or you can add additional search paths in the Properties box of the deployed application.
5. How can you debug failed assembly binds?
Answer:Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.
6. Where are shared assemblies stored?
Answer:Global assembly cache.
7. How can you create a strong name for a .NET assembly?
Answer:[_private/tbl_gglapck.htm] With the help of Strong Name tool (sn.exe).
8. Where’s global assembly cache located on the system?
Answer:Usually C:\winnt\assembly or C:\windows\assembly.
9. Can you have two files with the same file name in GAC?
Answer:Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 184.108.40.206 and the second one is 220.127.116.11.
So let’s say I have an application that uses MyApp.dll assembly, version 18.104.22.168. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 22.214.171.124. How do I tell the client applications that are already installed to start using this new MyApp.dll? Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC.
10. What is delay signing?
Answer: Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.