While Visual Studio .NET is the most popular
method of developing .NET applications, the Framework offers a
plethora of command-line tools. In addition, the .NET Framework SDK
provides additional command-line tools. In fact, IDEs such as Visual Studio and SharpDevelop
often utilize these tools. Let’s take a closer look at the tools
installed with the .NET Framework and how you may use them in your
projects. (Note: I utilize .NET Framework version 1.1 in this
article.)

Working with the .NET Framework

The default installation directory for the .NET
Framework command-line programs is:

C:\(base Windows
directory\Microsoft.NET\Framework\(framework version)

On my computer, I’m using Windows 2000
installed in the base winnt directory with version 1.1 of the .NET
Framework, so the path is:

C:\winnt\Microsoft.NET\Framework\v1.1.4322

This directory contains numerous dlls,
configuration files, executables, and more. For this article, I
concentrate on the executables. Here’s a rundown of these
programs:

  • Al.exe: 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 to create an
    assembly with the manifest in a separate file.
  • Aspnet_regiis.exe: This tool allows you to set up ASP.NET on IIS.
    In addition, it facilitates the use of multiple ASP.NET versions
    running side-by-side. It allows you to update the script maps for
    an ASP.NET application to point to the ASP.NET ISAPI version
    associated with the tool. The tool can also be used to display the
    status of all installed versions of ASP.NET, register the ASP.NET
    version coupled with the tool, create client-script directories,
    and perform other configuration operations.
  • Aspnet_state.exe: This tool allows session state information to be
    stored on a computer. It runs as a service, and it may be installed
    on a remote computer if the information is stored there.
  • Caspol.exe: The Code Access Security Policy tool enables users and
    administrators to modify security policy for the machine policy
    level, the user policy level, and the enterprise policy level. You
    can use Caspol.exe to write a batch script that configures security
    policy.
  • ConfigWizards.exe: This tool launches the .NET Wizards window
    (Windows Control Panel | Administrative Tools | Microsoft .NET
    Framework Wizards 1.1). It provides access to three tools: Adjust
    .NET Security; Trust An Assembly, and Fix An Application.
  • csc.exe: The Visual C# compiler. The /debug switch enters debug
    mode.
  • cvtres.exe: The resource-to-object converter. This tool is often
    used to convert a binary resource file to an object file. Native
    resources usually start life as an .rc file, get compiled to a .res
    file using rc.exe, get converted to a .obj file using cvtres.exe,
    and finally get linked into your native application like every
    other .obj file.
  • dw15.exe: This drives the error messages that you may see when
    using the Framework. The messages ask if you’d like to send
    Microsoft an error report. (Many users accuse this little program
    of being Microsoft spyware.)
  • Gacutil.exe: The Global Assembly Cache tool is used to manage the
    assembly cache. You can view the contents of the global cache, as
    well as add or remove assemblies. To use the utility to list all
    the assemblies in the Global Assembly Cache (GAC), use the /l
    switch. (The /i switch installs an assembly and /u removes it.)
  • IEExec.exe: This tool facilitates testing of URL-launched
    applications, including no-touch deployment applications such as
    Windows Forms. You use this tool instead of your IDE to debug these
    applications. It only accepts the URL parameter (e.g., IEExec.exe
    http://Server/TheApplication.Exe.); it doesn’t permit you to
    specify the zone setting and the site setting. If you try to
    specify the zone setting and the site setting, you receive
    errors.
  • Ilasm.exe: The MSIL Assembler generates a portable executable (PE)
    file from MSIL assembly language. You can run the resulting
    executable to determine whether the MSIL performs as expected.
  • Installutil.exe: The Installer tool allows you to install and
    uninstall server resources by executing the installer components in
    a specified assembly. This tool works in conjunction with classes
    in the System.Configuration.Install Namespace. For example, this
    tool is used when installing a Windows Service.
  • jsc.exe: A JScript .NET compiler. The /debug switch enters debug
    mode.
  • Migpol.exe: The Migration Policy tool provides the capability of
    migrating policies between two compatible versions of the .NET
    Framework.
  • Ngen.exe: 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.
  • Regasm.exe: The Assembly Registration tool reads the metadata
    within an assembly and adds the necessary entries to the registry;
    this allows COM clients to create .NET Framework classes
    transparently. Once a class is registered, any COM client can use
    it as though the class were a COM class. The class is registered
    only once, when the assembly is installed. Instances of classes
    within the assembly cannot be created from COM until they’re
    registered.
  • Regsvcs.exe: You may use the service installation tool to load and
    register an assembly, register and install a type library, or
    configure services added to a class. Regsvcs.exe requires a source
    assembly file specified by assemblyFile.dll. This assembly must be
    signed with a strong name. The strong name tool (Sn.exe) is
    available in the .NET Framework SDK.
  • vbc.exe: Visual Basic .NET compiler. The /debug switch enters debug
    mode.
  • vbj.exe: Visual J# .NET compiler. The /debug switch enters debug
    mode.

These tools run the gamut of .NET development.
Most of these tools support command-line switches (i.e., commands
preceded by a forward slash). These switches allow you to specify
setup options or utilize other facets of the tool (like compilers’
/debug option). You can view a complete listing of a tool’s
command-line switch options by entering the command followed by the
/? or /help. This provides you with complete syntax information to
take full advantage of the utility.

I often stick to the friendly confines of the
Visual Studio .NET environment, but after visiting a client, I now
appreciate the command-line options. I visited the site to install
code changes, but I also had to make additional changes once I was
onsite. These changes required code recompilation, but Visual
Studio .NET wasn’t installed on the machine. Luckily, I was able to
utilize the command-line utilities to do the job.

Choose your interface

Many developers prefer Visual Studio .NET’s
graphical environment and other development tools, but another
faction of developers are adamant about the control provided by the
command-line environment. Thankfully, Microsoft provides both
avenues to develop your application, so the choice depends upon
your preference.

TechRepublic’s free .NET newsletter, delivered each Wednesday, contains useful tips and coding examples on topics such as Web services, ASP.NET, ADO.NET, and Visual Studio .NET. Automatically sign up today!