Reputation: 1400
In my settings, I have two String settings and one connection string. These obviously show and are changeable in the web.config. On top of that, not in the settings, but in the web.config, I have my entity framework connection String.
I also have 4 different publishing profiles (Addresses to publish my website to)
However: They all run off the same config file. So I have to change it manually before each publish. And if i forget/get it wrong, the entire site siezes to work.
Is there any way, to link publish specific web.config files. So that each publish profile generates the correct version, with its correct values/connection strings.
Ive come accross transforms, and pubxml, but nothing seems to make sense or work, or even be compatible with VS 2010.
If anyone can link or explain the path i should be taking to achieve this, i would be gratefully happy. I have spent days trying.
Upvotes: 0
Views: 254
Reputation: 28376
The .pubxml and profile-oriented transforms are available in VS2010 through the Azure SDK Bundle. Here's how to do it:
At this point, you can create publish profiles as many of the newer blog posts show:
And add transforms for them:
And preview the transforming effects of each profile's transform (which does take into account the Debug/Release ones as well):
Upvotes: 0
Reputation: 3388
I would take a second look at web config transformations - it was built for exactly this and is most definitely supported in VS 2010. Alternatively I have worked with a deployment setup where there was a custom utility that did exactly what web config transforms does by running as a build task. Using the two I would still recommend web config transformations due to it being well documented.
Upvotes: 0
Reputation: 12904
You can create a new configuration in the Configuration Manager and then create the corresponding config for that profile.
When deploying, if you change the configuration to the correct one, it will then pick up the appropriate config.
How to: Transform Web.config When Deploying a Web Application Project
Upvotes: 1