Configuring NDiagnostics For Your Application

Configuring NDiagnostics involves the modification of an XML file using a set of preset elements and attributes. In a future release there will be a graphical configuration editor, but for now, the configuration file must be edited manually.

There are several options for specifying what configuration file to use:
  • Specifying the configuration filename on the command line - for example, NDiagnostics.exe AppDiag.xml - this instructs NDiagnostics to use the configuration file called "AppDiag.xml".
  • Running NDiagnostics.exe without specifying a configuration filename - in this case, NDiagnostics will look for a file called "NDiagnostics.xml" in the working folder (e.g. the folder where NDiagnostics.exe is being run). If the file is found, then it will be loaded and utilized for the diagnostics scan. If the file is not found in the working directory, then NDiagnostics will load an embedded resource file called "NDiagnostics.xml.txt" and utilize the diagnostics instructions located within it. This approach allows you to compile a custom version of NDiagnostics and run it on various workstations by copying a single executable (NDiagnostics.exe) - no configuration file need be present.
Regardless of the approach utilized to specify the configuration file, the XML within the file must follow this format:

<?xml version="1.0" encoding="utf-8" ?>
<NDiagnostics title="My Application Diagnostics">
  <Groups>
    <Group name=".NET Framework Check">
      <Task name="NETFXTask" description=".NET 2.0 Check" version="2.0.50215" />
    </Group>
    <Group name="Required Files/Folders Check">
      <Task name="FileTask" description="Data File" path="C:\NTUser.dat" version=""/>
      <Task name="FolderTask" description="Program Folder" path="C:\Program Files\My App" />
    </Group>
  </Groups>
</NDiagnostics>

The title attribute located within the <NDiagnostics> element specifies the text to be displayed in NDiagnostics title bar.

You must specify at least one <Group> element but there is no limit on how many <Group> elements you can have. Each set of tasks within a <Group> element will be grouped together within the user interface. The group's text as displayed on the UI is determined by the name attribute found within the <Group> element.

Within each <Group> element you must include one or more <Task> elements. The <Task> elements determine which diagnostic tasks will be performed. The current set of diagnostics tasks include:
  • Exec Task - allows you to run an external process and utilize the exit code to determine if it succeeds or not.
  • File Task - checks for the existence of a specific file and can also (optionally) check the version number.
  • Folder Task - checks for the existence of a specific folder.
  • NETFX Task - checks for a specific version of the .NET Framework.
  • Process Task - determines whether a specific process is running.
  • Registry Task - allows you to verify registry settings.
  • Role Task - allows you to verify that a user belongs to a specified group/role.
  • SQL Server Task - checks for connection to specified database; optionally check for table existence and/or query result.
  • URL Task - determines whether a specific URL is available (can verify web page or web service).
  • Windows Service Task - determines whether or not a specific Windows Service is installed, and optionally, the current status (e.g. running, stopped, etc.), startup type, and startup account.
NOTE: The order of task execution is determined by the physical order of the <Group> and <Task> elements within the configuration file.

Last edited Nov 21, 2007 at 3:01 AM by jbramwell, version 9

Comments

No comments yet.