Thursday, July 27, 2006

Important .NET Command Line tools

Assembly Linker

The Assembly Linker generates a file with an assembly manifest from one or more files that are either modules or resource files. A module is a Microsoft intermediate language (MSIL) file that doesn't have an assembly manifest. All Visual Studio compilers produce assemblies. However, if you have one or more modules (metadata without a manifest), you can use Al.exe creates an assembly with the manifest in a separate file.

Examples

Following examples shows a delay sigining using Assembly Linker

Al.exe Sample1.netmodule, Sample2.netmodule /delaysign+ /Keyfile:SamplePublicKey.snk /out:SignedSample.exe

-------------------------------------------------------------

Installer tool

Installutill.exe is used to install the assemblies which contain additional component resources. This tool works in conjunction with classes in System.Configuration.Install namespace. This tool performs installation in the transactional manner. If one of the assemblies fails to install, it roll backs the installation of all the assemblies. For example, this tool can be used when installing a window service.

Examples

To install the resourse in assembly Assembly1.dll, you need to execute the following command:

Installutil.exe Assembly1.dll

-------------------------------------------------------------

Native Image Generator

The Native Image Generator creates a native image from a managed assembly and installs it into the native image cache on the local computer. The native image cache is a reserved area of the GAC. Once you create a native image for an assembly, the runtime automatically uses that native image each time it runs the assembly.

Examples

Following example create native image of C:\MyApplication\bin\Assembly1.dll in current native image cache.

Ngen.exe /silent C:\MyApplication\bin\Assembly1.exe

Following examples create native image for assembly which directly reference to other assemblies. You must supply fully specified names of the references assemblies. ILDASM.EXE tool can be used to get fully specified assembly name.

Ngen.exe Assembly1.exe "myLibOne, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0038abc9deabfle5", "myLibTwo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0038abc9deabfle5"

-------------------------------------------------------------

Assembly Binding Log Viewer

Fuslogvw.exe tool display details for assembly bind. This information is very useful in case of failure in loading assembly due to location/culture mismatch.

Example

fuslogvw.exe

-------------------------------------------------------------

GacUtil

This command line utility is useful for adding/removing the assemblies from GAC in the automated environment.

Example

Following example list all the assemblies in GAC

Gacutil.exe /l

Following example uninstall assembly from GAC

Gacutil.exe /u RandomNumberGenerator

Following example uninstall a specific version and culture of assembly from GAC

gacutil /u hello, Version=1.0.0.1, Culture="de",PublicKeyToken=45e343aae32233ca

Following example install list of assemblies from a file

gacutil /il assemblyList.txt

---------------------------------------------------

Type Library Importer

COM components do not have manifest file embedded in assembly itself, instead meta data is stored in separate Type Library. A type library can be a separate file or it can be embedded within another file. Type Library Importer tool (tlbimp.exe) can make a RCW component from meta data stored in Type Library.

Example

Tlbimp.exe MyCustomerCOM.dll /out:MyCustomerNET.dll

---------------------------------------------------

DISCO.EXE

The Web Services Discover Tool (disco.exe) retrieves the discovery document if the web services includes a static discovery document (.disco file). The .disco file is an XML file containing useful URLs. These include the URL for the WSDL file describing the service, the URL for the documentation of the service, and the URL to which SOAP messages should be sent.

Example

disco.exe http://localhost/MyWebservice/service1.asmx /out:MyWebSerDocs

It generates two files, first is service1.wsdl and other is results.discomap. Wsdl is a XML file which contains description of interfaces of web services.

---------------------------------------------------

WSDL.EXE

This tool is used to generate web proxy class from wsdl file. In can be understand in this way that output of disco.exe is input of wsdl.exe.

Example

Wsdl.exe service1.wsdl

Wsdl.exe results.discomap

---------------------------------------------------

Continue...

No comments: