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:

0 - FX version 50727.42 is not installed
1 - FX version 50727.42 is installed

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

dotnetchk.exe -version="" -lcid:1033
0 - FX version is not installed
1 - FX version is installed but not langpack for LCID 1033
2 - FX version 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"/>

<Command PackageFile="dotnetfx.exe">

Comments (4)

  1. sbam says:

    This is great Chris, a very useful blog.

    I’ve been experiementing with dotnetchk.exe and can get the ExitCode from it with no problem, but I have another PackageFile – an MSI as a command, and ClickOnce doesn’t seme to pick up the ExitCode in the same way.

    Is this something I would have to tweak in ClickOnce, or in my MSI?  

    My MSI references a .Net Installer component via a Custom Action, and it’s from within there that I set my ExitCode.

    But ClickOnce is ignoring it and the log shows it thinks it installed successfully regardless of the ExitCode (which is defined in product.xml as a fail).

    Can you offer any clues please?

  2. ChrSmith says:

    To my knowledge the exit code from a custom action can not set the exit code for the entire Windows Installer package.

    The exit code for your custom action can indicate failure for the package as a whole, but I don’t think you can get the entire MSI to return ‘1042’ when it is done installing.

    I’ll follow up with a local expert and repost if I an wrong.



  3. sbam says:

    Thanks for the reply Chris. That makes sense, I’ll try something else.

  4. Michael Bate says:

    I attempted to run DOTNETCHK.EXE on a PC with Windows 2000 SP4.  It failed because it was looking for a non-existent entry point and gave this message:

    Procedure Entry Point HelpSetInformation could not be located in Kernel32.dll.

    If this is going to happen on people’s PCs, it sounds like DOTNETCHK.EXE is useless, unless I’m missing something.

    I posted a query about this on the MSDN .NET Framework Setup forum but nobody addressed the issue of the missing entry point.

    Michael Bate

Skip to main content