Search code examples
c#azureapp-configazure-deployment

Customize app.config when deploying on windows azure


I have some issues when I'm trying to deploy my application in windows azure.

I have several services in windows Azure. One of them is called Automaton. It needs to connect to the SQL Azure database. So I've saved the ConnectionString (I'm using Entity Framework) in the app.config and I added some transformation depending on the build configuration.

I've found a plugin that helps to add transformations to any XML file called slow cheetah (http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx)

When I'm trying to compile the code under different build configuration, I can see that the config file is well transformed (I've checked in the bin folder of my project). But, when I'm deploying the project in windows azure, I can see that my role is cycling due to database connection issue. So, I think the app.config isn't transformed when the solution is compiled for deployment purpose.

Do you have any information that can help me to fix my issue? Thanks


Solution

  • You would need to modify the azure project to tell it to update the app.config every time you package , as in the following tutorial step 10 -

    http://wely-lau.net/2012/03/14/applying-config-transformation-app-config-in-windows-azure-worker-role/