Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi ,


I am trying to create a strong name and add that dll to the GAC.
I have created the strong name for that dll.
But,when I am linking that strong name to the dll using AL command,
I am stuck.
It has the syntax as below,

al /out:[assembly name] [module name] /Keyfile:[file name]

But what is module name here.what we should give here?
Can you please help me.

Thanks,
Srikrishna
Posted
Updated 9-Dec-09 2:16am
v2

1 solution

Ok, first al.exe does not work with GAC per se. It just creates an assembly. The only parameter relative to GAC is Keyfile, as strong naming is required.

There are two level of packaging of the assembly. Usually, assembly is compiled in a single executable file (usually .DLL or .EXE, but can be anything else). The executable file itself does not represent assembly, it represent module. The most simple case I discuss here is: single assembly in a single module.

With MS Visual Studio, this is always the case. All assemblies created are single-module ones.

In this case, do not use module parameter in AL -- not at all.

More advanced case is when you create some executable modules first (by al.exe, csc.exe, etc.) Modules are just packages of code, they are assembly-agnostic. On this step, the module is a parameter for output file. On next step, you use the same or another compiler to create assembly itself, using the module(s) as input parameter. This step creates one more module called start-up module (for .EXE, it should contain main, for all assemblies, it should carry assembly manifest). The executable file created on this step contains manifest and all meta-data showing the .NET loaded what other modules to link to the assembly being created (those created on previous step(s)).

Why using modules at all? Well, the difference between single-module model is not so big. A module carries no assembly attributes such as version or security attributes (important).

What if you need to re-use some executable code if different assemblies? If the different assemblies use identical version, security, etc., it may make no sense -- make this re-used code another assembly. But what if you want to re-use this code in assemblies representing very different systems, developed almost independently, with different versions,.. well, you got it.
In this case, put the re-used code in a separate module(s). Modules are agnostic to assemblies, they will tolerate such abuse.

Finally, do you really need to use al.exe (or csc.exe) if you use Visual Studio to make assemblies accepted by GAC? No, the naked compilers are great if you do not have VS (the way to deploy source code to the users not having VS), but if you want to use just VS: go to project properties, the page under the item "Signing" -> "Sign the Assembly" -> "Choose a strong name key" -> Browse -> then use your already created signature file.

As to the module parameters in compilers, you got it: this is any file name for your choice (when you generate a module), only if it is an input parameter (step 2), it should be existing file.
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 10-Dec-10 14:35pm    
Whoever voted to my answer, what do you think is missing? Or ask any question; and I'll probably make a better answer (so you might re-think you vote)... I'm doing some work to help here, so wouldn't it be a fair deal?

Thank you for your interest to the topic.
Espen Harlinn 26-Feb-11 10:46am    
Impressive effort - my 5
Sergey Alexandrovich Kryukov 26-Feb-11 14:32pm    
Wow, thank you?
Did you decide to fix all unjust votes? :-) Not sure it worth the effort but thank you very much anyway.
--SA
Espen Harlinn 26-Feb-11 17:08pm    
Working on it - hope it's appreciated :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900