In .net we are having strong name for assembly. what is the actual use of this? how this internally used? if possible please explain the scenario
Asked
Active
Viewed 838 times
0
-
for example if two classes have same name in different assemblies and both assemblies are in use then you have to use strong name. – M.kazem Akhgary Oct 16 '15 at 09:45
-
thanks m. kazem. Still i am getting confuse. How we can use strong name to differentiate? can you please give some example? – Saravana Manikandan Oct 16 '15 at 09:52
1 Answers
1
Avoid strong naming (if you can)! Strong naming is a complete pain.
As soon as you strong name an assembly, everything that it references has to be strong named as well. In a simple application, no big deal. If you have to deal with COM interop libraries etc., other projects, etc the problem becomes a maintenance nightmare.
This is a good read.
From the link: Strong naming assemblies has many advantages:
- Trust. Users of the assembly can trust that it came from the signee, such as Red Gate Software, thanks to the public key cryptography involved.
- Tamper prevention. Users of the assembly can trust that nobody has tampered with it since the signee released it. The .NET runtime will not load assemblies whose signed hash doesn’t match their current hash.
- Compatibility with the GAC. The global application cache only accepts strong named assemblies.
It also has disadvantages:
- “The const problem”, or “One naming policy to rule them all”. Strongly named assemblies cannot use assemblies which aren’t strongly named. Like a virus, strong naming must spread throughout an application, or perish. This causes difficulties interacting with open source or other unsigned, third party components.
- Version coupling. Since an assembly’s strong name includes its version, the .NET framework generally requires that, if assembly A is using assembly B, the exact version of assembly B against which A was linked must be available at runtime.
- Compatibility with the GAC. The global application cache only accepts strong named assemblies.
I've not had much fun dealing with strong named assemblies in the past, particularly ones which expose interfaces for shared applications. You end up having to engineer round the strong named assembly (e.g. using publisher policy)

Jeb
- 3,689
- 5
- 28
- 45
-
Thanks lot Jeb. now i can understand. One more small question. while shipping the software we have to share snk file also. so anyway we can able to tamper it right? – Saravana Manikandan Oct 16 '15 at 11:04