Wednesday, August 17, 2011

Windows Azure Configuration Settings per build configuration (2)

It was not too long ago when I blogged about how to configure your Cloud Service project to respect build configurations and transform your CSCFG file based on this.

Things change though! The Windows Azure team is not sleeping and is constantly improving the development experience for the platform. One of the new features introduced with the latest Windows Azure Tools for Visual Studio 2010 (August 2011 update) is the Configurations manager:

This new manager allows you to keep more than one service configuration! Please remember that Service Configuration is not Service Definition! You still have the single Service Definition, but you can have multiple Service Configurations. Using it is so easy. Just right click on your Cloud project and select “Manage Configurations”:

There are additional options in the typical Role configuration screens, so you can manage the configuration settings per configuration:

For each configuration you create, the manager automatically adds a configuration file to the project. Naming convention follows the naming convention of the Web Projects we used to see:

Now, when you deploy your cloud project, the Publish screen had some more features, and one of them is a drop down menu with all configurations you have:

You may also have noticed that right from the Publish screen, there is also an option to chose the Build Configuration.

Although this is a great step toward making developer’s life easier I would set a couple of cons for this new feature:

  • There is no option to choose which configuration to use when debugging. If you use the default configuration files, which are created with a new project, then the “.Local.cscfg” is automatically used when using local compute emulator. But if you have existing project and you add new service configuration, then the original one, or the “Default” is used. “Default” configuration is the one that has no addition extension (i.e. ServiceConfiguration.cscfg)
  • We are forced to maintain two copies of the same file (Configuration settings). For me particularly mine approach before this tools update was better, in terms that you had to only put changes in different configuration files and not maintain the full set of properties.
  • This totally concerns mine project which still had mine transformations left and using the new tools, but having only single configuration in the Configuration Manager: the deployment did not take mine transformed file, but the original configuration file which was defined in the Configuration Manager! So be warned: if you were using the configuration transformation solution from my previous blog post, remove it and use the new Configuration Manager instead!

2011-08-23 Update on the first bullet:
There is an option to choose which configuration to be active during development/debugging. You need to go to Properties for the Cloud project, then select the “Development” tab. And there you will see similar screen with options to select which will be the “development/debugging” configuration: