471,123 Members | 962 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

Article : Assembly Linker (Al.exe .Net FrameWork Tools Series)

Hi All,

Assembly linker is a tool which is used to create an assembly by combining
one or more .netmodules and resource files.

In simple words an .netmodule is an IL file that does not have manifest in
it .... you can say its an assembly without the manifest ... and hence a
non -assembly file containing IL code.

In the yesterday's example we saw how we can create the .resources file
which by itself is a binary file containing your resource data. Today we
will see how we can embed or link this .resource file with other .netmodules
and create an assembly

1) Create 2 .netmodules say Module1.netmodule and Module2.netmodule
2) Create a .resources file say MyResources.resources (as we created in
yesterdays article ... please to the same for more details)
3) Now type the follwoing command to combine these modules and binary
resource file into a single assembly.

// to create a dll.
al Module1.netmodule Module2.netmodule /embed:MyResources.resources

// to create an exe.

al Module1.netmodule Module2.netmodule /embed:MyResources.resources
/out:MyExecutable.exe /target:exe /Main:Class1.Main
If you dont want to embed the resource file then use the /link option
instead of /embed option with al.exe.

Well if you have an want to embed or link a resource then you can compile
the resource file when you are compliing the assembly with csc.exe or
vbc.exe just use /resource to embed the resource or /linkresource with the

You can also achieve this from VS.Net studio by including the resource file
in the project and setting the Build Action of the resource type to Embedded

Al is mainly used by a lot of developers to create resource satellite
assemblies esp for creating multilingual applications by creating resource
assemblies for various cultures.

If only resource files are passed to Al.exe, the output file is a satellite
resource assembly.

E.g. To create an satellite assembly for french culture

1) Create a file named MyResource.fr-FR.txt
2) Type your name=value resource data in it to generate the resource file
3) generate the resource file with the name of MyResource.fr-FR.resources.
4) And finally create the satellite assembly as shown below for your

al /out:MyGlobApp.resources.dll /v:
/embed:MyResource.fr-FR.resources, Private

Note : Check out the Private keyword in the above command. You can use the
"private" option if you want dont want other assemblies to use the embedded
resource files by default it is "public".

5) In this command we have specified the output file name , the version of
this DLL , the culture "fr-FR" which denotes french and finally we are
embedding the fr-FR.resources file in MyGlobApp.resources.dll

6) Place this file in bin\fr-FR folder of your application and read it from
the application using the ResourceManger Class.

There are a lot of other options that are available with AL you can view
these options by typing al /? or al /help. I am enlisting a few important or
frequently used ones here :
a.. /copy[right]:<text> Copyright message
b.. /c[ulture]:<text> Supported culture
c.. /delay[sign][+|-] Delay sign this assembly
d.. /out:<filename> Output file name for the assembly
e.. /t[arget]:lib[rary] Create a library
f.. /t[arget]:exe Create a console executable
g.. /t[arget]:win[exe] Create a Windows executable
h.. /trade[mark]:<text> Trademark message
i.. /v[ersion]:<version> Version (use * to auto-generate remaining
j.. /win32icon:<filename> Use this icon for the output
k.. /win32res:<filename> Specifies the Win32 resource file

If you checkout the help at the end you will see this lines which show you
how to go about using this tool.

Sources: (at least one source input is required) <filename>[,<targetfile>]
add file to assembly

embed the file as a resource in the assembly

link the file as a resource to the assembly

-- Please post your queries and comments for my articles in the usergroup
for the benefit of all. I hope this step from my end is helpful to all of


Namratha (Nasha)

Nov 16 '05 #1
0 5181

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Namratha Shah \(Nasha\) | last post: by
reply views Thread by Namratha Shah \(Nasha\) | last post: by
2 posts views Thread by George Durzi | last post: by
reply views Thread by Namratha Shah \(Nasha\) | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.