|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sign assembly with strong name using al /out commandI have to sign a dll(without source code) with strong name and therefore I use the al /out command: al /out:<assembly name> <module name> /keyfile:<file name> (In this command, assembly name is the name of the assembly to sign with a strong name, module name is the name of the code module used to create the assembly, and file name is the name of the container or file that contains the key pair. ***quoted from MSDN) However, even after intensive searching through the web I still do not well understand the meaning of the <module name> parameter in the command, which is explained in: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconassigningassemblystrongname.asp And I still fail to sign the module Any help would be highly appreciated. Thanks, Thanks and Thanks!! Tom >I have to sign a dll(without source code) with strong name and therefore I You can't sign an existing unsigned assembly with Al.exe. Have you>use the al /out command: tried asking the DLL vendor if they can provide a strong named version? Mattias -- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Thanks for your reply. Perhaps I should try to ask the vendor for that then.
But I also would like to ask is this the only way to solve the problem? and just would like to ask what is the use of al /out then? In fact, I would like to register my DLL to component service (since I cannot call the dll using VB script), but it requires all used dll be strongly named. Are there any ways to register a dll without the need of strongly signing the dll? Many thanks!! Tom Show quote "Mattias Sjögren" wrote: > > >I have to sign a dll(without source code) with strong name and therefore I > >use the al /out command: > > You can't sign an existing unsigned assembly with Al.exe. Have you > tried asking the DLL vendor if they can provide a strong named > version? > > > Mattias > > -- > Mattias Sjögren [MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup. > >But I also would like to ask is this the only way to solve the problem? The only other option I can think of is to decompile and recompile theDLL with Ildasm.exe and Ilasm.exe. But I doubt the license allows that. >and just would like to ask what is the use of al /out then? Al.exe is only used to create an assembly from existing modules and/orresource files. A module in this context is a compiled managed executable without an assembly manifest. A module by itself can't be loaded, it must be part of an assembly. The /out switch simply sets the output filename of the assembly Al creates. So Al lets you create a new, strongly named assembly made up by existing modules. But it doesn't let you sign an existing unsigned assembly. (And neither does Sn.exe which is another tool used for signing stuff). Mattias -- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Thanks very much for your detailed explaination. In fact in these days I
have read many posts concerning migration from VB6 to .net, and you answered many of those questions:).My solution is to find the source of the dll(called aspftp.dll, luckily it is open source), then compile it and add the key into it. Then I use the tlbimp utility to sign all references that my project used. After all these are done and I can successfully register my DLL to component service. Unluckily, when I execute the program a runtime exception is thrown, which is: An unhandled exception of type 'System.BadImageFormatException' occured in mscorlib.dll Additional Information: The format of the file 'aspftp' is invalid where 'aspftp' is the dll name mentioned above. Before when I use this aspftp.dll in VB6 project, and migrate the whole project to vb.net, then VS.net2003 automatically generate interop.aspftp.dll for me, and the program works, except that it does not have strong name and I cannot register to component service. Now since I need to generate aspftp.dll myself from src (in order to sign it), I cannot use the Interop.aspftp.dll anymore, but use the one I generate myself, and exception thrown......just don't understand why...I am totally new to VB(never write one VB program) but my first task is to migrate an application to VB.net, and I really get tied of the endless problems raised:(. But I really learn more and more.. Thanks in advance. Tom,
>Before when I use this Oh so you're dealing with an interop assembly. Wish you had said that>aspftp.dll in VB6 project, and migrate the whole project to vb.net, then >VS.net2003 automatically generate interop.aspftp.dll for me, and the program >works, except that it does not have strong name and I cannot register to >component service. Now since I need to generate aspftp.dll myself from src >(in order to sign it), I cannot use the Interop.aspftp.dll anymore, but use >the one I generate myself, and exception thrown...... earlier. :) You will not be able to sign the COM component, aspftp.dll. You can only sign assemblies, in this case the interop assembly. You can generate a signed interop assembly with the Tlbimp.exe tool and its /keyfile option. No need to modify the COM component. Mattias -- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Thanks. In fact, at the beginning when I see your reply, I don't really
understand, since I tried many times to sign the Interop.aspftp.dll generated by VS.net 2003 but fail. But when I used the tbl command to sign the aspftp.dll directly, it succeeds! However, problem still continue to raise. The program says it cannot create ActiveX comonent when it runs CreateObject("aspftp.ASPFTP") Then I try to register the signed Interop.aspftp.dll to registry using regsrv32, it fails again, saying: Interop.aspftp.dll was loaded, but the DllRegisterServer entry point was not found. The file cannot be registered. Why can't I create an instance of the object? This does not happen if I use the Interop.aspftp.dll generated by VS.net2003 from the original VB6 project. Thanks a lot!! Tom Show quote "Mattias Sjögren" wrote: > Tom, > > >Before when I use this > >aspftp.dll in VB6 project, and migrate the whole project to vb.net, then > >VS.net2003 automatically generate interop.aspftp.dll for me, and the program > >works, except that it does not have strong name and I cannot register to > >component service. Now since I need to generate aspftp.dll myself from src > >(in order to sign it), I cannot use the Interop.aspftp.dll anymore, but use > >the one I generate myself, and exception thrown...... > > Oh so you're dealing with an interop assembly. Wish you had said that > earlier. :) > > You will not be able to sign the COM component, aspftp.dll. You can > only sign assemblies, in this case the interop assembly. You can > generate a signed interop assembly with the Tlbimp.exe tool and its > /keyfile option. No need to modify the COM component. > > > Mattias > > -- > Mattias Sjögren [MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup. > |
|||||||||||||||||||||||