0

When I publish my site the web.config of the dev version replaces the version on my target IIS 7 site. I need to release the same project to ~10 different sites with custom configs such as connection strings and log4net settings. Some of the sites share a server, but not all - so the Publish Web system is just incredibly good except for this. Now after every publish I manually go and fix each config. How can I avoid this issue?

I know I can do transformations for debug/release builds but I can't figure out how that could help during publish. Also, I really don't want to keep the custom settings within the Visual Studio project, because they are maintained directly on the release server and not in our version control.

Joel Peltonen
  • 13,025
  • 6
  • 64
  • 100

1 Answers1

0

You should use web.config transformations + solution configuration in order to automatize this. The idea is to have one solution configuration for each site you want to deploy to. Then when you deploy, you can create publish profiles and choose which solution configuration to use. Your specific settings will then be automatically applied.

Now if you really do not want to use this, the other way around could be to set postbuild events in your solution to delete the web.config file right after your build (in the output folder). Since Visual Studio builds systematically before publishing, this could work.

Superzadeh
  • 1,106
  • 7
  • 23
  • Thanks for the input, but it doesn't really solve my issue where I would want the configurations to stay on the server. It might be the best solution for now though; I think the fundamental cause might be unsolvable too, unless there would be a merge system like in a VCS during publish. Still, I'll leave the question open for now. – Joel Peltonen Jan 24 '14 at 07:13