Last week I offered developers a simple way to simultaneously deploy a web application to a Microsoft Azure web site and an Azure Cloud Services web role. Today I'm going to point out a particular pain with this approach that may make you reconsider trying to deploy to both environments.
Just to recap: since Azure web sites are free, or nearly so, you can save at least $15 a month by putting a demo instance of your app there rather than having a second web role for it. You'll still use a web role for your staging and production environments, of course.
While reading my last post, though, sharp-eyed developers might have noticed that the dual approach creates some additional maintenance overhead. Specifically, you'll need to keep both solution (.sln) files and both web project (.csproj) files in sync. This becomes part of your staging deployment task list, which means you probably only have to synchronize the files once every few weeks, not such a big deal. Still, if you've never hand-edited a solution or project file before, it can be a little daunting.
The solution file probably won't require much synchronization, unless you've added new projects—or new files outside of projects—to the solution. For example, at 10th Magnitude we like to keep all of our database scripts in the solution tree, for easy access. (We also use the open-source RoundhousE tool for database deployment, which I'll talk about in a subsequent post.) If we add new database files to the web site solution, they won't automatically show up in the web role solution.
Same with the web project file: adding new controllers, views, or web forms to a project is very common. So you'll have to make sure all the changes in the web site project get migrated over to the web role project.
Keep in mind, though, that some things will remain different between the two pairs of files. The web role solution will have a Cloud Services project, mapping the web and worker role entry points, which the web site won't have. And the web site project file will have references to Microsoft.WindowsAzure.ServiceRuntime.dll and msshrtmi.dll that the web role project won't have.
Here's a synchronized pair of solution files, using Beyond Compare to show the deltas:
And here are the two project files, also synchronized, showing the differences you need to wind up with:
One final thing to consider: if you have a paying client, they might not want to pay for development time to synchronize the two deployment environments. If you're charging $125 an hour, and you spend 30 minutes every four weeks—$62.50—to save the client $15 for an additional cloud services instance, that isn't good value. But for an internal application (like the 10th Magnitude brochure site), or for a personal project, the savings might be worth the hassle.