Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the 'module name' when using al.exe to sign an assembly with a strong name?

I am trying to sign an assembly with a strong name by following the guide from here: http://msdn.microsoft.com/en-us/library/xc31ft41.aspx

The key instruction is:

al /out:<assembly name> <module name> /keyfile:<file name>

And it says

module name is the name of the code module used to create the assembly

I don't understand what this means. In the literal sense I would interpret the above as some component of csc.exe (i.e., it created the assembly) but obviously this is nonsensical in this context.

So firstly what does this refer to, and secondly (in order to aid my meta-learning) how would one go about reasoning what it is? I get the impression given the terseness of the documentation that it should be obvious or intuitive to me, but it currently is not.

I tried specifying some random names (e.g. blah.blah) but get this error:

ALINK: error AL1047: Error importing file 'c:\path\to\proj\bin\Debug\blah.blah' -- The system cannot find the file specified.

Edit: Upon further reading I get the impression the module name is the name of the code, but I have not had any luck specifying the .cs files either - I am told Database file is corrupt and may not be usable.

like image 460
fostandy Avatar asked Dec 07 '10 02:12

fostandy


People also ask

How do you sign an assembly with a strong name?

In Solution Explorer, open the shortcut menu for the project, and then choose Properties. Under the Build tab you'll find a Strong naming node. Select the Sign the assembly checkbox, which expands the options. Select the Browse button to choose a Strong name key file path.

What is strong name in .NET assembly?

A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. It is generated from an assembly file using the corresponding private key.

What is Al exe?

The AL task wraps AL.exe, a tool that is distributed with the Windows Software Development Kit (SDK). This Assembly Linker tool is used to create an assembly with a manifest from one or more files that are either modules or resource files.

How do I sign assemblies in Visual Studio?

How to sign an assembly in Visual Studio. You sign an application or component by using the Signing tab of the project properties window (right-click the project node in Solution Explorer and select Properties). Select the Signing tab, then select the Sign the assembly check box. Specify a key file.


2 Answers

An assembly is made up of modules (.netmodule files), which are produced by compiling sources (.cs files). The assembly linker is responsible for packaging modules into assemblies. So if you have two source files class1.cs and class2.cs:

csc /t:module class1.cs
csc /t:module class2.cs
al /out:assembly.dll /t:library class1.netmodule class2.netmodule

For the best treatment of how the CLR deals with modules, manifests and assemblies, see Richter.

like image 195
lesscode Avatar answered Sep 22 '22 05:09

lesscode


In VS2010, click on Project Properties -> Signing Tab -> Check Sign this assembly.

Provide or create Strong name key.

like image 28
Rauld Avatar answered Sep 21 '22 05:09

Rauld