Frustrations with Web Deployment Projects

Web deployment projects are an elegant way of integrating the compilation of an asp.net web site into a build process. I was initially really impressed with the msbuild task that replaces sections of your web.config at build time. Unfortunately  this feature is starting to dissapoint. As this forum post points out it is fairly limited in scope as to what sections it can modify. I recently tried getting the deployment project to update the system.net/mailSettings section. I have yet to get it to modify this section. The build will just fail saying that it cant find system.net/mailSettings. This shouldnt be this hard. I hope I'm totally missing something and the rest of this post can just be ignored.


Ok, Im the moron on this one. under is a group not a config section as I orginally thought. Once I changed the deployment project to this:

system.net/mailSettings/smtp=mailSettings.config;

It worked like a champ.

So the moral of this story is check, double check and triple check what type of node you are trying to replace in the deplyment project.

I'm still not sure why it matters what type of node you are replacing.

Update: Some good ideas here for more advanced scenarios.

2 Comments

  • One other option to consider with web deployment projects is to have a separate web.config file for each deployment type (development, test, release). You could have them in your web project like so:

    dev-web.config
    test-web.config
    release-web.config

    You could then have your web deployment project overwrite the web.config that is used with the appropriate build based on your build settings.

    Hope this helps,

    Scott

  • Good suggestion. I was thinking of something like that as well. But in this particular case there are just a couple of places that need changes so the replacement stuff is working pretty well. (Now that I pulled my head out)

Comments have been disabled for this content.