If you have been reading my blog lately you will notice I have been using continuous integration. I am using the sweet web.config replacement feature of .Net 4 with my automated builds as well. Unfortunately my web.config file connectionString kept deploying with $ReplaceableToken in it instead of the actual connection string. Luckily, I figured out why.
I am using command line to do the publish. Turns out that the way I am building actually is creating deployable packages that have commandline installers in them. I noticed that if I go to the obj/release/transformwebconfig/transformed folder the web.config is in there perfect. The reason for this is you can specify more parameters in another config file in the obj file and run the .cmd that is generated to publish straight to IIS. Unfortunately for me I did not want to do this.
I wound up just using xcopy to pull the correct web.config to the right folder before the final publish. My IIS7 machine will not allow automated publishes like that as I am sure most of your corporate environments are the same way.