Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# - can you make a "weak" assembly reference to a strong named assembly

For various reasons i would rather not use strong named (signed) assemblies in my project. however, one of the projects is referenced by a sharepoint web part which means it must be signed.

is it possible to have this assembly signed but when I reference it from other projects, to do so using a non-strong reference. this would give me the advantages of having a non-signed assembly for the rest of my code but still allow it to be loaded by sharepoint.

like image 267
Tim Avatar asked Mar 22 '10 11:03

Tim


2 Answers

The simplest way to do this is probably to have two different project configurations - one of which builds a strongly named assembly and one of which doesn't. Obviously you'll need to be careful how you build and reference the assembly, but that goes with the territory of having conflicting requirements.

like image 179
Jon Skeet Avatar answered Sep 30 '22 01:09

Jon Skeet


Just keep building your project w/o strong names. When you need to deploy it to Sharepoint, use a tool to sign it after it is built. Here's a tool that does exactly that:

http://signer.codeplex.com/Wikipage

You can also do it manually, but it's a PITA:

http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing/

like image 26
Fábio Batista Avatar answered Sep 30 '22 01:09

Fábio Batista