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>
  

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.

    Thanks,

    -Chris

  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

    michaelbate@comcast.net