0

I have a few web applications using the same databases. I'm deploying them all in the same "Web site" on IIS. The connection strings will be set at the "Web site" level and inherited in the "Applications". When I make a publish package, it gives me a list of the connection strings in the web.config but doesn't let me choose to remove them. I have to change the value or leave it empty (which uses the one in my local web.config).

The goal is to end up with a "clean slate" package that I can publish in different "Web site" that has their own connection strings (production server vs staging vs development for example). I want to be able to deploy a package to the staging environment for testing and, after testing, deploy that same package to production.

1 Answer 1

2

I would use web.config transformations to solve it. Then you can have different connection string for web.debug.config / web.production.config / we.test... and so on. You can replace in the connection string or the entire element. Here is a start: https://msdn.microsoft.com/en-us/library/dd465326%28v=vs.110%29.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

If you create different config for each environment you (or a tool like Octopus deploy) will execute the transformation on deploy. Your package (created on build) will contain all config transforms but it will be applied on deploy. Perhaps not your idea on "clean slate" but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.