0

I have a winforms solution with multiple projects (UI, web services, data access). All of these projects have their own app.config file. At install time, I need to change the connection string in the data access project based on user's database configuration.

But the data access project creates a dll at install time, with no app.config file available for updating. The UI project is the only project with an app.config file created. And the UI project has a reference to the data access project, so I don't believe the data access project can "see" the config settings of the UI project.

I have searched SO for an answer but have not found anything specific to this situation. Am I doing something wrong in how my projects are set up? Any help would be appreciated.

Jeff
  • 739
  • 12
  • 31

1 Answers1

0

For anyone else facing this issue:

I believe I found the answer here

In Visual Studio, on the properties of each config file, you can choose "Copy Always" for Copy to Output Directory. This will explicitly create the config file for dll projects.

Then in InstallShield, you can refer to this config file ("MyApplication.dll.config" for example), and alter the connection string through the "Text File Changes" section under "System Configuration". When the user is prompted to connect to a sql server, InstallShield can use those connection properties to alter the connection string in the config file.

Community
  • 1
  • 1
Jeff
  • 739
  • 12
  • 31