DotNetChk.exe

I have had a lot of questions from Bootstrapper users about how to check if the .Net Framework is installed on the target system or not.  Although we are discussing adding a new InstallCondition into the Bootstrapper for Orcas, the way to check using Visual Studio 2005 is to use the application dotnetchk.exe.

Dotnetchk.exe (a package file for the DotNetFX Bootstrapper package) is an application designed to be used as an ExternalCheck to determine if a particular version of the .Net Framework is installed on a computer.

Here are the various command line parameters and possible exit codes:

dotnetchk.exe
0 - FX version 50727.42 is not installed
1 - FX version 50727.42 is installed

dotnetchk.exe -version="3.0.0.0"
0 - FX version 3.0.0.0 is not installed
1 - FX version 3.0.0.0 is installed

dotnetchk.exe -version="3.0.0.0" -lcid:1033
0 - FX version 3.0.0.0 is not installed
1 - FX version 3.0.0.0 is installed but not langpack for LCID 1033
2 - FX version 3.0.0.0 and langpack is installed

Here is a brief snippet of how the .Net Framework 2.0 Bootstrapper package uses the dotnetchk:

<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="dotnetchk.exe"/>
</PackageFiles>

<Command PackageFile="dotnetfx.exe">
<InstallConditions>
<BypassIf
Property="DotNetInstalled"
Compare="ValueNotEqualTo"
Value="0"/>
</InstallConditions>
</Command>