You would need an immediate custom action to read the .config file, find the appropriate connection string, and set its value to a property.
<CustomAction Id="MyAction" ExeCommand="cmd.exe /C MyDatabaseInstaller [CONNSTR] " Execute="deferred" Return="check" /> If you're using WiX from Visual Studio, you can go to File > New Project, and choose Windows Installer XML > C# Custom Action Project. (Or C++ if you prefer). The C# version will generate a method for you which represents your custom action entry point, with a Session object which represents the MSI session. You can treat it like a dictionary when it comes to properties: // Get a property string cfgFile = session["ConfigurationFilePath"]; // Whatever code you need to find the right connection string // Set a property session["CONNSTR"] = connstr; The C++ version uses a bunch of functions all beginning with Wca. I can't remember the syntax right now but the set and get functions for properties aren't too difficult IIRC. On 27 August 2013 19:32, Carl Enander <c_enan...@hotmail.com> wrote: > Hello, > I am new to Wix and have a question regarding wix and reading settings > from an xml file when running the installer. I have an xml file with > database connectionstrings that are different for my test and production > environment: > <configuration><prodservername><connectionstring>connstr1</connectionstring></prodservername><testservername><connectionstring>connstr2</connectionstring></testservername></configuration> > When running installer I want to use the [COMPUTERNAME] variable to find > the correct connectionstring value from the xml file and use this in a > Custom Action (e.g. "conntr1" to be used when installing on prod server and > "connstr2" on test server):<CustomAction Id="MyAction" > > ExeCommand="cmd.exe /C MyDatabaseInstaller Connstr " > Execute="deferred" > Return="check" /> > Please guide me to the best way to do this simple task. > > BR, Carl > > > > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users