My task is to create an installer that does the following:
1. copies files to the installation directory without overwriting the App.Config file if it already exists (maintains existing settings from prior installs)
2. after copy, READS the App.Config file and gather's some settings from it and their current (default) values.
3. Prompt the installer user for overrides to any of these settings using dialog boxes prepopulated with the current values from step 2
4. WRITE the values back to the installed App.Config file provided by the user (either the left-alone defaults, or the user's changed input from their input dialogs)
5. Complete the install...
My problem lies in step 2. I am in my custom action static function (called LoadDefaultOptions) and I'm creating an XMLDocument and attempting to load the App.Config file using a session variable that points to the install directory and the file name of the installed App.Config file, as such:
Code: Select all
String AppConfig = session["CONFIGFILE"];
session.Log("Attempting to load the Configuration File to read the defaults at " + AppConfig + ".");
XmlDocument xDoc = new XmlDocument();
xDoc.Load(AppConfig);
Attempting to load the Configuration File to read the defaults at C:\Program Files\<correct path to installed app.config> ( from the session.Log() )
LoadDefaultOptions exception: System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\Installer\MSI2548.tmp-\C:\Program Files\<correct path to installed app.config>'. (from the .Load() attempt)
Why is the load function prepending that Windows\Installer\MSIXXXX.tmp- string before my filepath? Can I get rid of this? How do I read files from the file system from a customAction?
BTW, it seems like ANY filestream action I take, whether from an XmlDocument, XmlReader, or FileStream object ALL prepend this value before any URL... Can't find a work around...
Any help is appreciated!
FOLLOW US
Get the latest news in Application Packaging