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.
Updated 10-Dec-10 7:49am
v3