Jonathan's answer is good. I tweaked it slightly to allow the original Web.config file to be retained. These are the lines I added to the bottom of my .csproj file:
I can see that the web.config file is transformed by running a build within Visual Studio (or from a command line).