- Question - Define .Net Assembly.
Answer - It is a primary unit of deployment in a Microsoft .NET Framework application. It is called as building block of an application which provides all required execution information to common language runtime[CLR]. An assembly perform following functions:It contains IL code that gets executed by common language runtime. It forms a security boundary. An assembly is the unit at which permissions are requested and granted. It ensures type safety by establishing name scope for types at the runtime. It contains version information. It allows side-by-side execution of multiple versions of same assembly. Assemblies can be static or dynamic. Static assemblies are created when the program is compiled using .Net compiler. It exists as PE file either in .exe or .dll. However, dynamic assemblies are created at runtime and run from the memory without getting saved on the disk. - Question - What does an assembly contain?
Answer - An assembly contains following information: Assembly manifest: Information about the assembly. Type metadata: Information about the types. IL Code Resource files.
An assembly manifest contains the following information:
Identity of the assemblyTypes and resourcesFilesSecurity permissions - Question - Define private assembly and a shared assembly.
Answer - A private assembly is stored in the application’s directory and used by a single application. A share assembly can be used by multiple applications and is stored in the Global assembly cache, a repository of assemblies maintained by the .Net Framework. - Question - What are Satellite Assemblies?
Answer - Satellite assemblies provide an application the multilingual support. Satellite assemblies contain alternate sets of resources to be used in the application for different cultures. - Question - What do you understand by side-by-site execution of assembly?
Answer - This means multiple version of same assembly to run on the same computer. This feature enables to deploy multiple versions of the component. - Question - How do you create a resource-only assembly?
Answer - Resources are nonexecutable data in an application and the data can be updated without recompiling application. Resource assemblies can be created as follows:Add resource files to an empty project. Built the project.The resource will get compiled into assembly. - Question - Explain how to retrieve resources using ResourceManager class.
Answer - ResourceManager class is used to retrieve resources at run time. Create a ResourceManager with resource file name and the resource assembly as parameters.After having created, you can use ResourceManager.GetString method to retrieve a string.Use the ResourceManager.GetObject method to retrieve images and objects from a resource file. - Question - Define Strong Name. How do you apply a strong name to assembly?
Answer - A strong name means generating public key in order to provide unique name to the assembly.The name is used to provide global name to the assembly and allows it to be shared amongst several different applications. The key generated include assembly's name, the version number, the developer's identity, and a hash number. The developer's identity identifies the author of the assembly. The hash checks if the assembly is tempered since it is created. The key pair that defines the strong name is created using the Strong Name utility, Sn.exe.
To sign an assembly with a strong name
Create Key pair using the Strong Name utility, Sn.exe. Open the AssemblyInfo file of your project. Use the AssemblyKeyFileAttribute to specify the path to the key file for your project. Build your assembly. The strong name will be generated and signed to the assembly. - Question - Define Global Assembly Cache.
Answer - Global Assembly Cache is the place holder for shared assembly. If an assembly is installed to the Global Assembly Cache, the assembly can be accessed by multiple applications. In order to install an assembly to the GAC, the assembly must have to be signed with strong name. - Question - How do you install assembly to the Global Assembly Cache?
Answer - Followings are the steps to install assembly to the GAC. Sign assembly with a strong name using strong name utility, sn.exe. Open the AssemblyInfo file for your project. Use the AssemblyKeyFileAttribute to specify the path to the key file for your project. Build your assembly. Install the assembly to GAC by using gacutil utility e.g. gacutil -i abc.dll
2.8.08
.Net Assembly
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment