Share via


Using app.config in the July 2009 CTP

In the July 2009 CTP of the Windows Azure Tools for Microsoft Visual Studio, we introduced a bug where if you use the App.Config file in a Worker Role, it won’t get included in your Service Package both when running on the local Development Fabric or in the Cloud.

To resolve this issue, simply add the following environment variable before starting Visual Studio:

AddAppConfigToBuildOutputs=true

This will be fixed in our next release, in fact it’s fixed in our daily builds already.

What happened?

In order to support TFS Build, we changed how files are copied to the package for the Worker Role.  As part of the changes, we missed calling one of the targets with a property set to handle the App Config.

It was lucky for us that our customers can workaround the issue by setting the environment variable above and MSBuild will do the right thing.

Scenario

To elaborate on the scenario, if you create a new Cloud Service with a Worker role by clicking File | New Project | Visual C# | Cloud Service and adding a Worker Role:

image

Right Click on the WorkerRole1 project in Solution Explorer and select Add | New Item and select the “Application Configuration File” item.

image

Build the solution and navigate to the Service Package (more info on Service Packages) and you’ll find that the app.config file is missing from the worker role.  (no WorkerRole1.dll.config)

This is true in the packaging for the Development Fabric and if you Published for the Cloud.

Exit Visual Studio and add the environment variable: AddAppConfigToBuildOutputs=true

Then restart Visual Studio and open up that same solution you were working on.

Rebuild All and again navigate to the Service Package.  This time you will see the WorkerRole1.dll.config file as you would expect.

Sorry for the inconvenience, again this is temporary and you now know the workaround.

Some forum threads about this: