Why do you deploy an assembly into GAC?

To allow other application to access the shared assembly.

Which type of assembly is stored in GAC?

Shared assemblies

What is gacutil.exe?

It’s a command to install the assembly into the Global Assembly Cache.

Explain this error : BadImageFormatException : Types Defined in a Referenced Assembly at Run-time.

Error : BadImageFormatException occurs when trying to Instantiating Types Defined in a Referenced Assembly at Run-time.

Cause : Instantiating Types Defined in a Referenced Assembly at Run-time

Resolution : Rebuild the referenced assembly using the “AnyCPU” setting. This would allow the class contained in it to be instantiated within a 32-bit process, or in a 64-bit process.

What is the difference between Namespace and Assembly?

1. It is a Collection of names wherein each name is Unique.
2. They form the logical boundary for a Group of classes.
3. Namespace must be specified in Project-Properties.

1. It is an Output Unit. It is a unit of Deployment & a unit of versioning. Assemblies contain MSIL code.
2. Assemblies are Self-Describing. [e.g. metadata,manifest]
3. An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.

Does C# support friend classes like in C++?

No, about the closest you can come using the internal keyword, which allows access within the current assembly. But, there is no way to specify specific a class that knows about another class’s private implementation.

What are the three Register directive attributes used to add custom controls to a Web form?

TagPrefix: The TagPrefix defines a unique namespace for an user control. If multiple user controls are present on the page having same name, then they can be differentiated with them by using this directive. It determines the group that the user control belongs to.

Namespace: It is nothing but the project name and namespace within the custom control assembly that contains the controls to register. The .NET applications use the project name as an implicit namespace for controls present in the application.

Assembly: This defines the name of the created assembly (.dll) that contains the custom controls. The control assembly is referenced by the Web application and it maintains a copy in the web applications ‘Bin’ directory.