1

I am working on a web project as a Web Site, rather than a Web Application. How can I use a different config file depending on where it is hosted from, so the local version uses my local SQL install, but the published version uses the live database? e.g. connectionStrings.config ignored (not published), connectionStrings.live.config published as connectionStrings.config

I see a policy file option, would that be something able to do this?

SamWM
  • 5,196
  • 12
  • 56
  • 85

4 Answers4

3

Use a MSBuild or NAnt script for different builds.

rball
  • 6,925
  • 7
  • 49
  • 77
3

There are several options regarding this. The simplest is to use a web deployment project. The ScottGu's post goes into more detail on this.

For larger projects you will need something like Nant or MSBuild and CruiseControl or TeamBuild.

I also posted something here a while back on supporting complex config deployments

Community
  • 1
  • 1
Dan
  • 1,003
  • 1
  • 7
  • 16
2

You can use a Web Deployment project. Check out ScottGu's blog post.

Robert S.
  • 25,266
  • 14
  • 84
  • 116
1

Post Build Event which swaps the config over?

you can have a different post build event depending on your build configuration, each can copy a different config if needed.

Mark Broadhurst
  • 2,675
  • 23
  • 45
  • Can't see a post build event option, as I just open it as a website project, e.g. 'file' > 'open' > 'website' – SamWM May 07 '09 at 16:19
  • I think Saint is referring to development vs. production. By default you config should point to dev, then change when you deploy to production (assuming you're deploying prebuilt code) – Mike Robinson May 07 '09 at 16:29
  • Ahh sorry you are working on a web site project, unfortunatly these are the only project types (which build) which dont have a pre\post build event. – Mark Broadhurst May 07 '09 at 16:44