|
Introduction to .NET Framework Tools
|
by Suresh Kumar Goudampally
Feedback
|
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days):
68724/
138
|
|
|
Introduction |
The Microsoft framework tools are designed to make it easier
to create, deploy and manage applications and components that target the .NET
Framework.
The .NET Framework tools can be divided into the following
categories.
1.
Configuration and Deployment tools
2.
Debugging tools
3.
Security tools
4.
General tools
In this article we will be discussing the following tools.
1.
gacutil.exe
2.
sn.exe
3.
al.exe
4.
aspnet_regiis.exe
5.
aspnet_compiler.exe
6.
dbgCLR.exe
7.
aspnet_regsql.exe
8.
installutil.exe
9.
disco.exe
10. ildasm.exe
11. ilasm.exe
12. aspnet_regbrowsers.exe
13. wsdl.exe
|
Gacutil.exe - An Insight |
Gacutil.exe is a .NET utility library which provides the
command-line interface tool that manages the Global Assembly Cache.
The global assembly cache util tool is used to view and manipulate
the contents of the global assembly cache.
The command syntax of the gacutil.exe tool looks like the
following.
gacutil [options] [assembly name | assembly path | assembly
listfile]
assemblyName : The name of the assembly.
assemblyPath : The path of the file that contains the
assembly manifest.
assemblyListFile : The path to an ANSI text file that lists
assemblies to install or uninstall.
Here are the some of the commands of Gacutil.exe tool
through which we can manage the Global Assembly Cache.
Command Name
|
Description
|
/l
|
This command is used to display the list of all the
assemblies that are contained in the Global Assembly Cache.
Eg: gacutil /l
|
/I assemblypath
|
This command is used to deploy a strongly named assembly
into Global Assembly Cache.
Eg: gacutil /i test.dll
|
/u
assemblypath
|
This command is used to remove a DLL from Global Assembly
Cache.
Eg: gacutil /u test.dll
|
/h
|
This command displays the command syntax and options for
the tool.
Eg: gacutil /h
|
/if
assembly path
|
This command installs the DLL in the Global Assembly Cache
and if the DLL already exists in GAC, it overrides it.
|
/ldl
|
This lists the contents of the downloaded files cache.
Eg : gacutil /ldl
|
/ul
Assembly path
|
It uninstalls one or more assemblies specified in the
assemblylistfile from the GAC.
|
/?
|
This displays the command syntax and options for the tool.
|
/f
|
It specifies this option with the /i or /il options to
force an assembly to reinstall. If an assembly with the same name already
exists in the global assembly cache, the tool overwrites it.
|
|
Sn.exe - An Insight |
This is the tool which helps assemblies to sign with strong
names. Sn.ex provides various options for key management, signature generation
and signature verification.
Here are the some of the commands of Sn.exe tool through
which we can manage the strong key and signing an assembly.
Command Name
|
Description
|
-k
|
Creates a random key pair and stores in a file.
Eg : sn –k keypair.snk
|
-v
|
This command is used to check whether the assembly is
valid or not.
Eg: Sn –v TestAssem.dll
|
-p
|
This command is used to extract the key pair value from
one file to another file.
Eg: sn –p kepair.snk ss.snk
|
-?
|
Displays all the options available for the tool.
Eg : sn –?
|
-h
|
Displays all the options available for the tool.
Eg : sn –h
|
-c
|
This is used to set the default Cryptographic service
provider for signing the assembly.
Eg: sn -c
|
-e
|
Extracts the public key from the assembly and stores it in
outfile.
|
-vl
|
Lists current settings for strong name verification on
this computer.
|
-R assembly infile
|
Re-signs a previously signed or delay signed assembly with
the key pair in infile.
|
|
Al.exe - An Insight |
The Assembly linker tool generates a file with an assembly
manifest from one or files that are either modules or resource files.
The general syntax of using tool is as below:
Al Source options
Here are the some of the commands of the al.exe and their
description in detail.
Option
|
Description
|
/embed[resource file name]
|
This command embeds the file into an image and copies the
contents of the file into the portable executable file.
The output for the resource file will be a assembly which
is called satellite assembly.
|
/link [resource file name]
|
The file name can be in any of the format and here the
file is not copied. This option will generate a native dll and can be
installed in the global assembly cache.
|
/bugreport : file name
|
Creates a bug report in the specified path if there are
any bugs.
|
/copy[right]:text
|
This is used to specify the copyright field in the
assembly.
|
/c:text
|
This option is used to specify the culture for the
assembly.
|
/delay[sign][+][-]
|
Specifies whether assembly can should be fully signed or
partially signed. By default it is fully signed.
|
/descr:text
|
Specifies the description filed in the assembly.
|
/fileversion:version name
|
This option is used to specify the file version for the
assembly.
|
/help
|
This displays all the options available with the tool.
|
/key:filename
|
It specifies the key pair value in a file to sign the
assembly.
|
/main:methodname
|
Specifies the fully qualified name (class.method) of the
method to use as an entry point when converting a module to an executable
file.
|
/out:filename
|
Specifies the name of the file produced by Al.exe. This is
a required option.
|
Examples:
Example 1: Generating an satellite assembly using the
resource file
Al
/link:"c:\inetpub\wwwroot\Samples\Exensys.Resources.resx","c:\inetpub\wwwroot\Samples\Exensys.Resources.resx"
/out:Testsss.resources.dll /c:en-US.
|
Aspnet_regiis.exe - An Insight |
This tool is mainly used to register the ASP.NET version
coupled with the tool and many other configuration operations.
Here are some of the commands of Aspnet_regiis.exe tool.
Command Name
|
Description
|
-c
|
Installs the client-side scripts for ASP.NET, such as
client-side validation scripts, to the aspnet_client subdirectory of each IIS
site directory.
Eg : Aspnet_regiis -e
|
-e
|
Removes the client-side scripts for ASP.NET from the
aspnet_client subdirectory of each IIS site directory.
|
-i
|
Installs the version of ASP.NET associated with
Aspnet_regiis.exe and updates the script maps at the IIS metabase root and
below.
|
-lk
|
Lists the path and version of all IIS metabase keys where
ASP.NET is mapped.
Eg : Aspnet_regiis -lk
|
-lv
|
Lists the status and installation path of all the versions
of the .NET installed on the computer.
Eg : Aspnet_regiis -lv
|
-u
|
Uninstalls the version of ASP.NET associated with
Aspnet_regiis.exe from the computer.
Eg: Aspnet_regiis -u
|
-ua
|
Uninstall all the versions of the ASP.NET from the .NET.
|
-?
|
Displays all the options of the tool.
|
-h
|
Displays all the options of the tool.
|
|
Aspnet_Compiler.exe - An Insight |
Aspnet_Compiler is a new tool which enables you to compile
the .Net web applications either in-place or in a target location such as the production
server.
This is the new tool introduced in the ASP.NET 2.0 version.
In-place compilation helps application performance because
end users do not encounter a delay on the first request to the application
while the application is compiled.
These are some of the options of the tool where we can
compile the web applications.
Option
|
Description
|
-m metabase path
|
This command specifies the full iis metabase path of the
application to be complied.
Aspnet_compiler -m /LM/W3SVC/1/ROOT/WebService2 -f
c:\InetPub\wwwroot\SampleWebService
|
-v virtualPath
|
Specifies the virtual path of the application.
Eg: Aspnet_compiler -v /Sample1
|
-p physicalpath
|
Specifies the full physical path of the root directory
where the application is located.
Eg: Aspnet_compiler -v /WebApplication1 -p
"c:\Documents and Settings\Default\My
Documents\MyWebApplications\WebApplication1"
|
-d
|
Overrides the debug setting in the applications
configuration settings.
|
-C
|
This option specifies that the application to be complied
should be fully rebuilt.
|
-errorstack
|
Specifies that the tool should include stack trace if it
fails to compile the application.
|
-nlogo
|
Suppresses the copy right message.
|
-?
|
Displays all the available options of the tool.
|
There are other options, like –keyFile, which contain the
key value pair and -aptca, -delaysign and –fixednames.
The compilation is different for types of files like:
Code behind files are complied into assemblies.
Handlers, like .ashx file, are not complied to output as is.
Source files, like .cs and .vb, are not copied into output
directory.
Custom file types are not compiled, they are just copied as is.
App_code directory is compiled into assemblies.
Skin files are just copied.
.resx files are compiled in resource DLL's.
.config file are just copied.
|
DbgClr.exe - An Insight |
This tool mainly provides the services for debugging the
solutions to find out the bugs and fix the bugs. This tool provides debugging
services like rich Graphical interface and helps developers to debug the
applications that target the common language runtime.
Microsoft visual studio debugger and DbgCLR.exe are much the
same with only some differences.
Here are the some of the differences between Microsoft
visual studio debugger and DbgCRL.exe debugger:
Using DbgClr.exe, we cannot debug the win32 native code
applications.
Only applications targeted to common language runtime can be
debugged using DbgCLR.exe.
Remote dubbing is not possible using DbgCRL.exe.
The Disassembly window is implemented in the CLR Debugger,
but shows the disassembly code that would be generated for the application if
it were compiled as Win32 native code rather than common language runtime code.
The DbgCLR.exe does not support F1 help.
The CRL debugger does not support the auto windows feature.
This is all about DbgCLR.exe tool.
|
Aspnet_regsql.exe - An Insight |
The aspnet_regsql.exe tool is used to register the MS SQL Server
database which is used by the providers in ASP.NET.
The aspnet_regsql.exe is located in the following on the web
server:
[drive:]\%windir%\Microsoft.NET\Framework\version folder
You can run aspnet_regsql.exe as a command-line tool to
specify database elements for individual features to add or remove, using the
options listed in the table below.
Command Name
|
Description
|
-?
|
Describes all the help options of the command.
|
-w
|
Runs the tool in the wizard mode with specifying the
options.
|
-C<connection string>
|
Specifies the connection string to the computer running
sql server where the database needs to be installed.
|
-S <server>
|
This option is used to specify the name of the sql server
where the database needs to be installed.
|
-U<user id>
|
This option is used to specify the user id of the sql
server to login with.
|
-P
|
This is used to specify the password of the sql server to
login with.
|
-E
|
This option uses the windows credentials of the currently
logged on user.
|
|
Installutil.exe - An Insight |
Installutil.exe is the tool which allows us to install or
uninstall server resources in a specified assembly.
This tool works with the support of the classes in the System.Configuration.Install
Namespace.
The syntax of using the tool is as follows:
installutil [/uninstall][option [...]]assemblyname ]
[option [...]]assemblyname
These are the following options provided by the tool.
Option
|
Description
|
/h
|
Displays all the available options of the tool.
Eg: Installutil /h
|
/assemblyName
|
Specifies the name of the assembly.
|
/? assemblypath
|
Displays any additional options recognized by individual
installers within the specified assembly.
|
/LogFile=[filename]
|
Specifies the name of the log file where install progress
is recorded. The default is assemblyname.InstallLog.
|
/i
|
Installs the specified assembly.
|
/u
|
Uninstalls the specified assembly.
|
Example 1:
Installutil -I assembly1
This installs the specified assembly.
Example 2:
Installutil /u assembly1
This uninstalls the specified assembly.
Example 3:
installutil /LogFile=myLog.InstallLog myAssembly.exe
The following command executes the installers in the
assembly myAssembly.exe and specifies that progress information will be written
to myLog.InstallLog.
Installutil.exe cannot install or uninstall delay signed
assemblies, but can install or uninstall strong named assemblies.
|
Disco.exe - An Insight |
This tool is used to discover the URL of the web service located
on the web server and save the documents related to each web service.
The syntax to use this tool is:
disco [options] URL
The URL is the path of the web service for which we need to
discover the .wsdl , .xsd , .disco and .discomap files.
These are the following options provided for using the tool.
Option
|
Description
|
/d: domain
|
Specifies the domain name to use when connecting to the proxy
server that is used for authentication
|
/nosave
|
This option is used to indicate the discovered documents
needed be saved to disk.
|
/o:directory name
|
Specifies the output directory where you save the
discovered documents.
|
/proxy:url
|
Specifies the url of the proxy server to use for http
request.
|
/proxydomain:domain
|
Specifies the domain to be used when connecting to a proxy
server that requires authentication.
|
/proxyusername:name
|
Specifies the username to be used when connecting to a
proxy server that requires authentication.
|
/u:user name
|
Specifies the username to be used when connecting to a
proxy server that requires authentication.
|
/?
|
Displays all the available options.
|
Examples:
Example 1:
This generates .wsdl and .disco files of the give web
service disco http://localhost/testwebservice/testService.asmx.
Example 2:
This generates .wsdl and .disco files of the given web
service in the given directory path:
disco /out:"D:\\Personal" http://localhost/testservice/testService.asmx
The generated .wsdl and .disco files can be used as inputs
to Wsdl.exe to create xml web service clients.
|
ILdasam.exe - An Insight |
This tool is used to convert the PE file which contains the
Microsoft Intermediate Language into a text file, which can be use as input to
the Ilasm.exe tool.
The syntax for using this tool is:
ildasm [options] [PEfilename] [options]
These are some important options available with the tool
Ildasam.exe tool to generate the MSIL code.
Option
|
Description
|
/output=filename
|
This option is used to generate the MSIL file with a
specific filename given.
|
/rtf
|
This option produces the output in the rich text format.
This is new option is available in .Net Framework 2.0
|
/text
|
This option displays the MSIL code in the console window
instead of a file so that we can watch the msil code in the immediate window.
|
/html
|
This option produces the ouput in html format using the
output:filename option set.
|
/?
|
This displays the set of options available with the tool.
|
/bytes
|
It shows the msil code as a hexadecimal code which is easy
to view.
|
/noca
|
This option suppresses the output of custom attributes.
This is new in .Net framework 2.0
|
/pubonly
|
Using this option we can disassemble only the public
members.
|
/source
|
This option shows original lines of code in comments along
with msil which can be easily readable.
|
/visibility:vis[+vis...]
|
Disassembles only types or members with the specified
visibility.
|
/classlist
|
Includes the list of classes defined in the module. This
is new in .net framework 2.0.
|
/noil
|
Suppresses MSIL assembly code output.
|
/stats
|
Includes statistics on the image.
New in the .NET Framework version 2.0.
|
Ildasm.exe only operates on PE files on disk. It does not
operate on files installed in the global assembly cache.
Example 1: To generate the MSIL of .dll in a given file:
ildasm "C:\Documents and Settings\suresh\My
Documents\Visual Studio Projects\Samples\TestClassLibrary\bin\Debug\TestClassLibrary.dll"
/output:mytestfile.il
Example 2: To generate the MSIL using actual source as
comments:
ildasm /source "C:\Documents and Settings\suresh\My
Documents\Visual Studio Projects\Samples\TestClassLibrary\bin\Debug\TestClassLibrary.dll"
Example 3: To generate the source code in graphical
representation:
ildasm /bytes "C:\Documents and Settings\suresh\My
Documents\Visual Studio
Projects\Samples\TestClassLibrary\bin\Debug\TestClassLibrary.dll"
Example 4: To generate a msil out of an .exe:
ildasm Test.exe /output:Test.il
|
ILasam.exe - An Insight |
The ilasm.exe tool is used to generate a Portable Executable
(PE) file from Microsoft Intermediate Language (MSIL). So we can run the PE
file and check whether the MSIL code runs as expected.
The syntax of using ilasm.exe tool is:
ilasm [options] nameofthefile [[options] nameofthefile...]
The nameofthefile is the .il source file which consists of
MSIL instructions.
Here are some important options which can be used with the
tool.
Option
|
Description
|
/dll
|
Produces the .dll file as an output.
|
/exe
|
Produces the .exe file as an output.
|
/fold
|
This option is used to fold the identical method bodies
into one. This is a new option available in .Net framework 2.0
|
/include=filepath
|
This is used to set the path for including the file using
#include.
|
/key=filename
|
Complies the file with strong signature using the key
specified in the given file name.
|
/mdv=versionstring
|
This option is used to set the meta data version. This
option is new in .Net framework 2.0.
|
/output:file.extenstion
|
This option is used to specify the output filename and
extension. The default extension is .exe.
|
/optimize
|
Optimize the long instructions to short; this is new in
.Net Framework 2.0.
|
/resource:file.res
|
Includes the specified resource file in *.res format in
the resulting .exe or .dll file. Only one .res file can be specified with the
/resource option.
|
/?
|
Displays all the available options of the tool.
|
Example 1: Generating a .dll using MSIL file
Ilasm filename /dll
Example 2. Generating a .exe using MSIL file
Ilasm testfilename
Example 3: To generate a .dll with a specific name
ilasm FileName /dll /output:Test.dll
|
aspnet_regbrowsers.exe - An Insight |
The Aspnet_regbrowsers.exe is registration tool which parses
and compiles all system-wide browser definitions that are contained browser
files into an assembly and installs the assembly into Global Assembly Cache.
In ASP.NET 1.1 the browser information of all the supported browsers was contained in a section called <browserCaps>, where the meta data is
in the form XML entries for various browsers.
In ASP.NET 2.0 a new file called .Browser maintains the data
of all the browsers in the form xml entries.
We can find the .Browser files of various browsers in the
following path:
\Microsoft.NET\Framework\version\CONFIG\Browsers on your
system.
These files are complied into an assembly called
Asp.BrowserCapsFactory.dll using the Aspnet_RegBrowsers.exe tool.
This allows the server to access the new browser information
immediately so you do not have to shut down any of your applications to pick up
the information. An application can access browser capabilities through the
Browser property of the current HttpRequest.
These are the options provided by the Aspnet_Regbrowser.exe.
Option
|
Description
|
-?
|
Displays all the available options provided by the tool.
|
-i
|
Creates the assembly and deploys in the GAC.
Eg: Aspnet_Regbrowsers.exe –I
|
-u
|
Uninstalls the assembly from the GAC.
Eg : Aspnet_Regbrowsers.exe -u
|
Do not change the predefined browser definition files that
come with ASP.NET because service packs might update those files and overwrite
your changes.
Application-specific browser definition files can be placed
in the application's App_Browsers directory. In both locations, browser
definition files must have a .BROWSER file name extension. Using the ASP.NET
Browser Registration tool has no effect on application-specific browser
definition files stored in an application's App_Browsers directory.
Using the <browserCaps> element in the Web.config file
to define browsers is deprecated in the .NET Framework version 2.0, but is
still supported. The data in this element is merged with the information from
the browser definition files.
|
Wsdl.exe - An Insight |
The Wsdl.exe is Web Services Description Language tool which
generates code for xml web services, and xml web service clients from Wsdl contract
Files, xsd schemas, and discovery documents.
The syntax for using this tool is:
wsdl [options] {URL | path}
The url is used to mention path to the .wsdl file, .xsd file
or discovery document.
The Path is used to mention path to the .wsdl file, .xsd
file or discovery document.
These are some of the options of the Wsdl tool with
description.
Option
|
Description
|
/urlkey:key
|
Specifies the configuration key to use in order to use the
default value for the url property when generating code.
|
/d: domain
|
Specifies the domain name to use when connecting to a
server that requires authentication.
|
/l:language
|
Specifies the language in which the code should be
generated.
Eg: C# , Vb .
|
/n: namespace
|
Specifies the namespace of the proxy class to be
generated.
|
/o: FileName or Directory Name
|
Specifies the file (or directory) to save the generated
proxy code to.
|
/parameters
|
Read command-line options from the specified xml file. Use
this option to pass the Wsdl.exe tool a large number of options atone time.
|
/protocol: protocol name
|
Specifies the protocol to implement. You can specify SOAP
(default), HttpGet, HttpPost, or a custom protocol specified in the
configuration file.
|
/server
|
Generates an abstract class for an XML Web service based
on the contracts.
|
/u: userName
|
Specifies the user name to use when connecting to a server
that requires authentication.
|
/?
|
Displays all the options available with wsdl.exe tool
|
/proxy:URL
|
Specifies the URL of the proxy server to use for HTTP
requests.
|
Example 1:
To create a proxy class:
wsdl
http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
A class by name myProxyClass.cs is generated.
Example 2:
To generate a class in VB:
wsdl /language:VB /out:myProxyClass.vb
http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
|
Summary |
This article mainly describes the .NET Framework tools which
are mostly useful and used in the development of .NET applications. We can run
these tools using the Visual Studio command prompt. The main idea of this
article is that how effectively we can manage and deploy the different .NET
applications using these tools. This article tried to provide clear samples to
execute so that it is easy for developers to understand. We have also summarized
all the tools in a nut shell.
|
|
|
|
Product Spotlight
|
|