Debugging Code for ObjectInstaller

If you're working on ObjectInstaller-related code, such as creating a new method for installing an object, you don't want to have to test it by creating a complete MSI and running through an installation. That's why the command-line utility was created. It allows you to take an XML file and pass it to the ObjectInstaller class to test out an install. But what if you need to walk through the code as it's installing? Here's how to set that up...

Note: This description assumes that your Visual Studio environment is located on the same machine as your site server. For configuring debugging in general, see Setting up a Development Environment

First, you need to set up the Build Events of your InstallerCLI project, so that following a successful build, the files in the debug directory are copied to your target setup directory. Within that directory also need to be copied the latest assemblies (and PDBs) for the Integration Kit and any required ConfigMgr assemblies.

Next, set the Debug settings for the InstallerCLI project to Start External program and point it to the target setup directory and the SCCMIdkInstaller.exe file. In the Command line arguments box, enter the name of the installer XML file you want to test, and specify the Working directory the same as where the executable is located.

Finally, when you want to debug, just right-click the InstallerCLI project, then select Debug > Step into new Instance. This will now go into the code line by line, allowing you to find and fix bugs a lot easier.

Last edited Feb 12, 2009 at 7:10 PM by rhearn, version 1

Comments

No comments yet.