1

I'm creating an InstallShield 2011 basic MSI installer project.

I'm trying to change the connection string in my app.config according to the user selections from the database login dialog made in the setup. How can I apply these connection string settings to the connection string entry in the app.config of my windows application I'm trying to install?

XML File Change is the right place to start from. Since changing the connection string is a common task my hope was that there is a best practice to do exactly this task.

-- edit --

There are two main difficulties:

  • How do I reference a file in InstallShield which will be created on build? The App.config gets copied to MyAppName.config. I don't want to hardwire the application name into the setup at this place again.

  • The connection string in the config file is used by Entity framework, thus contains more information than given by the database selection from InstallShield. I have to patch an attribute within an element of the config file, if I just want to change the Server and InitialCatalog properties of the connection string. It looks like XML File Change only supports replacing of an entire element or attribute.

Lars
  • 657
  • 8
  • 19
  • I finally added two additional elements for the Server and InitialCatalog which can be replaced by XML File Changes. Afterwards I assemble the connection string as required on runtime. Not beautiful but works. – Lars Oct 01 '13 at 12:42

1 Answers1

0

As far as I remember, the XML File Changes is designed for this purpose. You can place the user's choice as a property value when defining your XPath and element/attribute values. For me, it was one of the areas of InstallShield which worked quite good and as described.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • XML File Change is the right place to start from. But I still have some detailed difficulties there. See my edited question. – Lars Mar 03 '11 at 14:42