Jeff
Jeff

Reputation: 737

InstallShield - setting the SQL Server connection string for Entity Framework at time of install

Has anyone out there been able to accomplish this task? InstallShield prompts the user to connect to their local / networked sql server database and collects all that information (server name, catalog, username, password, etc.).

I need to plug this information into a connection string for entity framework, not replacing attribute values, but actually doing a text replace within the attribute value. I.E. replace "MyServer" with the server name they connect to.

In working with InstallShield I do not see a way to take those connection settings and "plug them in" to the EF connection string. Anyone had success with this?

Upvotes: 0

Views: 1022

Answers (1)

Jeff
Jeff

Reputation: 737

The answer for this is to use the InstallShield feature "Text File Changes" found under the "System Configuration" section. This feature allows you to take the user-defined connection properties for sql server and replace text in the config file.

For example, my base config file contains the text "Server=MyServerName;" in the connection string. InstallShield finds this text and replaces it with "Server=[IS_SQLSERVER_SERVER];" which comes from the prompt where the user connects to their sql server instance.

For some reason the "XML File Changes" does not allow for text replacement and that's where I was getting off track.

Upvotes: 2

Related Questions