How a signed application can use an unsigned assembly (which can be regenerated on client sites)

My C # .net executable needs to be signed to use one of the methods in our other assembly, which provides password access.

The same executable must reference and use an assembly that is not signed. The reason it is not signed is because we provide clients with the option to regenerate it on the site (it transfers access to the modeled settings in the app).

Is there a way that a single executable can use both signed and unsigned assemblies?

+3


source to share


2 answers


You cannot reference an unsigned assembly from a signed assembly, but you can easily load it using one of the Assembly.Load methods .

Typically, you provide an interface (or base class, if you like) in a signed assembly and use it throughout your code to get information at compile time. The unsigned assembly client (plugin) implements this interface in some specially dedicated classes. Than your application loads the assembly (either from the default location through Load

, or from the specified file through LoadFile

), finds and constructs the class, than uses it to get information at runtime.



Note. You can also see "How to Implement Plugins in C # /. Net" for approaches.

+9


source


I believe the only way to use an unsigned assembly is to load it at runtime using reflection.



You cannot add a strong name to your executable if it refers to something that is not strongly named.

+1


source







All Articles