C# – Getting location of setup.exe in custom action


C# 2005

I am using a installer class as I need a custom action that will read in a xml config file.

So when the user double clicks the setup, there will be a config.xml file in the same folder. I would like to read in this config.xml file on install event. The folder will contain setup.exe and config.xml

However, it can't find the config.xml file as it is looking for it under C:\windows\system32. I found this out by using applicationstartup.path. However, the setup folder which contains the setup and config.xml is located on my desktop.

I thought it will look for it in the current location. Which would be the setup folder.

The difficulty is that my setup folder will be downloaded from the Internet and any user could download it and unzip it anywhere on their computer.

Here is my code snippet for the on install event.

Many thanks for any advice

protected override void OnAfterInstall(System.Collections.IDictionary savedState)
        DataTable dt = new DataTable();


Best Solution

Assuming you're talking about an MSI, isn't that the OriginalDatabase property?

Related Question