A strong name is a .NET assembly name combined with its version number and other information to uniquely identify the assembly. This allows multiple versions of the same assembly to peacefully co-exist in the global assembly cache, where shared assemblies are typically stored. It consists of five parts as mentioned below
- Simple Name – Usually the name of the file (without the extension) that contains the assembly
- Public Key – RSA cryptographic public key that helps verify the assembly’s authenticity
- Version – Four-part version number, in the form of Major.Minor.Build.Revision
- Culture – Target audience for the assembly, such as “neutral” (default audience), “en-us” (English – United States) or “fr” (France) etc.
- Processor Architecture – Defines the assembly’s format, such as MSIL (intermediate language) or x86 (binary for Intel x86 processors)
We have a set of steps that should be followed to create a strong name as shown below.
- Open .net command prompt.
- Go to the folder containing DLL.
- Type sn -k test.snk, This will create test .snk file in that folder.
- Open the assemblyinfo.cs file of project.
- Type file path in this tag [assembly:AssemblyKeyFile@”E:\Code\practice\HP\bin\Debug\HP.snk”)]
- Build application, finally your strong name created for your DLL.
- Requires Exact Match. If you use strong names, your application or library must load the assembly with the exact strong name that you specify, including version and culture.
- Cannot Lose Private Key. If your private key is lost or stolen, the security of your assembly is compromised. You will be forced to re-issue a new assembly signed with a new public-private key pair.
A program database files holds debugging and project state information that allows incremental linking of debug configuration of your program. A PDB file can be up to 2GB.
It is signing an assembly with its strong name public key, which is freely distributable, instead of using the private key as usual. This allows developers to use and test a strong-named assembly without access to the private key. Then at a later stage (typically just before shipping the assembly), a manager or trusted key holder must sign the assembly with the corresponding private key.
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations.
- Type metadata.
- The assembly manifest, which contains assembly metadata.
- Microsoft intermediate language (MSIL) code that implements the types.
- A set of resources
Assemblies are of four types
- Private – The assembly is intended only for one application
- Shared – If the assembly is to be made into a Shared Assembly(GAC)
- Static – These are the .NET PE files that you create at compile time.
- Dynamic – These are PE-formatted, in-memory assemblies that you dynamically create at runtime
- A .NET Framework assembly containing resources specific to a given language.
- Using satellite assemblies, you can place the resources for different languages in different assemblies.
- The correct assembly is loaded into memory only if the user elects to view in that language.
- Culture is maintained in a text file which acts like a resource to the assembly.
Below are the steps to create a satellite assembly
- Set the paths for resgen and al.exe:
- Create a .resources file.
- Create the satellite assembly.
- The assembly should have the naming convention for .NET to be able to search for it.
- Specify the settings for culture.
- Put the satellite assembly in the appropriate folder.
- Once the satellite assembly is created, physically copy it to the appropriate directory.
- Repeat the process for each language in which you are creating an assembly.
Disclaimer – F5debug Interview Questions & Answers Series:
You may recopy extracts from these pages (“the material”) to individual third parties website or to the local system internal websites for their personal information, but only if:
You acknowledge the www.f5debug.net as the source of the material. Such acknowledgment should include reference to the www.f5debug.net in the copy of the material and should also include the words ” © Karthikeyan Anbarasan, www.f5debug.net “. You inform the third party that these conditions apply to him/her and that he/she must comply with them.