tags:

views:

104

answers:

2

what is the advantages of using strong named assemblies. What are the thing that can't be done without normal assembly.

+5  A: 

Let me List the benefits of Strong naming your assembly first:

  1. Strong naming your assembly allows you to include your assembly into GAC (Global Assembly Cache) thus allow you to share it among multiple applications.

  2. Strong naming guarantees unique name for that assembly. Thus no one else can use same assembly name.

  3. Strong name protect the version lineage of an assembly. A strong name can ensure that no one is able to produce a subsequent version of your assembly. Application users are ensured that a version of the assembly they are loading come from the same publisher that created the version the application was built with.

  4. Strong named assemblies are signed with a digital signature. This protects the assembly from modification. Any tampering causes the verification process that occurs at assembly load time to fail. An exception is generated and the assembly is not loaded.

More on Strong Naming from Microsoft is found here, but Lav pretty much sums it up.

Kyle Rozendo
Thanks +1 for quick answer
Are you sure on item 4? I think maybe this bahavior has changed recently. I tried to get the loading of an strongly named assembly to fail by modifying it, but it loaded without incident.
Jens
@Jens: Did you manually try and verify the strong name?
Kyle Rozendo
@Kyle: I tried. Before the modification, sn.exe could verify the strong name, after my modification, the verification failed. It was still loaded by my application without warning message, though.
Jens
@Kyle: See here: http://msdn.microsoft.com/en-us/library/cc713694.aspx
Jens
That's why I asked if you do the manual check. You can use the assemblies Evidence object to check the strong name hash.
Kyle Rozendo
+1  A: 

I've got one addition to Kyle's list

5 - Strong naming assemblies allows you to use the InternalsVisibleToAttribute.

This allows you to declare types and members as internal and still access them from another specified assembly as if they where public. One example when this is useful is when you reference a production assembly from a unit test assembly, and you want to easilly unit test production code without having to declare certain types or members public.

Mahol25