Problem solve Get help with specific problems with your technologies, process and projects.

Attempting to use the Windows Installer

I am attempting to use the Windows Installer. I want to load an empty database (Jet) if and only if an existing copy of the file does not exist. This will allow me to upgrade without losing the file. Presently, the file always loads, even if the file already exists.

  1. 1) Where is documentation on how to do this (if any)?
  2. If no documentation is available, are there any examples available?
    In .NET, you have a new project type called Setup Project, which generates Windows Installer setup files. The project supports Launch Conditions, which are divided in Search Target Machine (a search in the registry or a search for a file), and Launch Conditions (yes, again). The searches can be stored in sort of "environment" variables that can be checked in the subsequent launch conditions checks. This is a good place to search for the file you want to preserve and maybe stop installation of the DB (if it's a separate MSI).

    On the other hand, a more flexible approach is using Custom Actions, which are regular .NET executables or DLLs that perform any arbitrary task (in your case, check for a file and copy a fresh one from a temporary location if it doesn't exist, for example). You can even pass arguments to the assembly, such as the installation folder selected previously or any other value collected through custom fields during installation.

    A straightforward article about this is located at http://www.fawcette.com/vsm/2002_11/online/ferracchiati/default_pf.asp. But, of course, the first location for help is the product documentation itself.

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.