English 中文(简体)
Change the connection string in app.config with InstallShield 2011 setup
原标题:

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.

问题回答

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.





相关问题
Correct place to install demostration projects?

With the new Windows 7 restrictions (well, new to Windows Vista anyways), we can no longer install demo projects to %ProgramFilesFolder%OurApplicationdemo since restricted users will not be able to ...

.deb package conffiles problem

I am distributing one of my applications using a .deb package, but have a problem relating to one of the files. The distribution includes a database file which is constantly updated by the app, on a ...

Closing an application using WiX

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this. <util:...

VS 2005 Setup - HKCU

I am trying to fix an existing application that uses a Visual Studio 2005 setup project. We are requiring it to work on limited user accounts for XP, our app is written in C# for .Net 2.0. It writes ...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

configsource and installer

I have an project csproj, with app.config file, and logging Ent.Library section using configsource attribute. The logging section is in ahother file Configloggingconfiguration.config. I have a ...

热门标签