Debugging Tools for Windows
The Debugging Tools
for Windows package is a freely available support package that contains
a set of powerful debuggers and tools to help in the software
troubleshooting process.
The package comes in two flavors: 32-bit and 64-bit depending on which
architecture you want to debug.
There are three user mode debuggers available in the Debugging Tools for Windows package—NTSD, CDB, and WinDbg—and one kernel mode debugger (kd).
Although these debuggers are three separate tools, it is important to
understand that they all rely on the same core debugger engine. The most
significant difference between the debuggers is that WinDbg has a graphical user interface (GUI) component, making it easier to work with when doing source level debugging. In contrast, NTSD and CDB
are purely console-based debuggers.
After choosing the flavor of
the debugger (32-bit or 64-bit), the installation process for Debugging
Tools for Windows is straightforward and the default installation
options are typically sufficient. The default installation path is
%programfiles%\Debugging Tools for Windows
Please note that at the
time of publishing the most recent version was 6.8.4.0.There should be
relatively minor changes in the debugger output. The debugger
download URL also keeps a history of prior debugger versions (going back
two or three releases) that can be downloaded. If you want to use the
exact same version, you can download the Debugging Tools for Windows
corresponding to version 6.8.4.0.
.NET 2.0—Redistributable
The .NET 2.0
Redistributable component constitutes the core of the .NET platform. It
contains all the fundamental runtime components that are needed for .NET
2.0 applications to run, including all framework assemblies and the
.NET runtime binaries.
The
distinction between framework assemblies and runtime binaries is
important as there has been quite a lot of confusion surrounding the
various .NET releases. Not counting service packs, the following
releases are currently available: 1.0, 1.1, 2.0, 3.0, and 3.5. Table 1-1 illustrates the main difference between each version.
Table 1. Currently Available Major .NET Versions
| .NET Version | Included in Windows | Architecture | Latest SP | Runtime Changes | Framework Changes |
|---|
| 1.0 | None | X86 | 3 | Initial Version | Initial Version |
| 1.1 | Windows Server 2003 | X86, x64, IA64 | 1 | No | Yes |
| 2.0 | Windows Server 2003 R2 | X86, x64, IA64 | 1 | Yes | Yes |
| 3.0 | Windows Vista | X86, x64, ia64 | | No | Yes (notably WPF, WCF, WF) |
| 3.5 | Windows Server 2008 | X86, x64, ia64 | | No | Yes |
If you are running
on an operating system where the .NET 2.0 redistributable component is
not installed, the installation process is straightforward. Simply
navigate to the installation URL and select the default installation
options.
.NET 2.0—SDK
Although the
redistributable package enables .NET applications to run on a computer,
the .NET SDK component enables developers to create .NET applications by
providing
all the necessary tools (compiler, assembler, build tool) and
libraries. The .NET SDK does not provide a GUI-based integrated
development environment but rather a command-line driven environment.
Prior to installing the
.NET 2.0 SDK, ensure that the .NET 2.0 Redistributable package has been
installed. To install the .NET 2.0 SDK, navigate to the download URL
and launch the setup. You will have a few options as part of the
installation process:
Install quick
start samples. Quick start samples are great tools when you want to get
started building .NET applications. They include small pieces of sample
code in the different .NET areas (such as ADO, interoperability, and
networking).
Tools
and Debuggers. This option installs a number of tools and debuggers.
The debugger that comes as part of the .NET 2.0 SDK is DbgClr. DbgClr is
a source-level GUI debugger with a look and feel similar to that of
Visual Studio. If you are familiar with the Visual Studio debugger,
using DbgClr will be a very similar experience.
Product
Documentation. It is strongly recommended that you install the product
documentation as it contains a ton of information useful when developing
.NET applications.
The last step of the installation process is to select the installation location (default is %programfiles\Microsoft.net\SDK).
Included with the .NET 2.0 SDK
is a build utility called MSBUILD. It is the same build utility that
Visual Studio utilizes and works on the basis of defining the build
process in XML format. Listing 1 shows an example of an MSBUILD project file for a simple .NET command line application written in C#.
Listing 1. MSBUILD project file for simple .NET command-line application
<Project DefaultTargets = "Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<!-- Set the application name as a property -->
<PropertyGroup> <appname>Welcome</appname> </PropertyGroup> <!-- Specify the inputs by type and file name --> <ItemGroup> <CSFile Include = "simple.cs"/> </ItemGroup>
<Target Name = "Compile"> <!-- Run the Visual C# compilation using input files of type CSFile --> <CSC Sources = "@(CSFile)" OutputAssembly = "$(appname).exe"> <!-- Set the OutputAssembly attribute of the CSC task to the name of the executable file that is created --> <Output TaskParameter = "OutputAssembly" ItemName = "EXEFile" /> </CSC> <!-- Log the file name of the output file --> <Message Text="The output file is @(EXEFile)"/> </Target> </Project>
|
To build an MSBUILD
project, simply invoke the MSBUILD utility and point it to the project
file (located in the same folder as source code):
C:\MSBuild>c:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe build.xml
Microsoft (R) Build Engine Version 2.0.50727.1434
[Microsoft .NET Framework, Version 2.0.50727.1434]
Copyright (C) Microsoft Corporation 2005. All rights reserved.
Build started 4/7/2008 10:25:36 AM.
Project "C:\MSBuild\build.xml" (default targets):
Target Compile:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Csc.exe
/out:Welcome.exe simple.cs
The output file is Welcome.exe
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.86