Signing Unsigned DLLS

  • Thread starter Thread starter Ryan
  • Start date Start date
R

Ryan

Hello everyone,

I am using a 3rd party component that is a managed .NET
dll, however the author decided not to strong name the
assembly. When I go to strong name my assembly that's
referencing it, I get the 'Unable to emit Assembly' error
messages. Is there any way to give a dll a strong name
if I don't have the source code?

Thanks in advance.
 
Ryan,
If the assembly doesn't have any signing at all (not even delay signing)
then there is no out-of-the-box way to sign it.
However, you should consider loading and calling the unsigned assembly via
remoting. It is harder but it should solve your problem.
Disassembling to recompile the original third-party assembly doesn't seem a
good option because you may violate copyright laws.

Please let me know if you succeeded with the reflection approach.

--
Thanks.
Paulo

DISCLAIMER: This posting is provided "AS IS" with no warranties, and confers
no rights. Use of any included code samples are subject to the terms
specified at http://www.microsoft.com/info/cpyright.htm"
 
Paulo Lisboa said:
Ryan,
If the assembly doesn't have any signing at all (not even delay signing)
then there is no out-of-the-box way to sign it.
However, you should consider loading and calling the unsigned assembly via
remoting.

I think he meant to say "reflection", as remoting still requires a
reference.

In VB you can to reflection just by removing your reference and changing all
of your variable types to object.

dim w as new Flarg.Widget
w.DoSomething

becomes

dim asmFlarg as Assembly =
System.Reflection.Assembly.LoadFrom("d:\app\bin\flarg.dll")
dim w as object = asmFlarg.CreateInstance("Flarg.Widget", True)
if w Is Nothing Then
Throw New Exception("Cound not create Flarg.Widget")
End If
w.DoSomething() 'the VB compiler automatically generates the reflection code
for invocation

David
 
Hi Ryan:

One way to work around this is to use the third party code by reflection,
then you can avoid the strongname restriction when it is compiled. And you
can write a wrapper to hide all the details of reflection, such that your
code just needs a small change.

Hope it helps!

Qiu
 
Thanks guys, yeah that seems to work fine. Too bad there
isn't an easier approach to it. De-compiling was my
other idea but thats probably not a good idea with
copyrighted software.
 
Back
Top