Thursday, May 30, 2013

Building and publishing azure solution in TFS 2010

The process of creating continuous integration process in azure is well described here http://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/

Unfortunately there are several issues you might encounter that are not covered in above document.

On of them is related to the error message below:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets (632): The role 'SchedulerWorkerRole' was not found in the service definition. Parameter name: roleName

The simple solution is to add "/m:1" argument to the "MSBuild Arguments" for the Build definition. So your full MSBuild Arguments field will look something like this:

/t:Publish  /p:TargetProfile=Cloud /Property:PublishDir="//testserver/Deployment/BuildTemp/" /m:1

Explanation of why it works

In our solution we have several worker roles and web roles as part of the solution. With Azure SDK 2.0 and TFS Build all files including ServiceDefinition.csdef are copied to the single output directory. By default TFS Build includes /m flag which uses multiple threads (= number of cores) to build a solution. They can result in projects built in slightly different order and overwriting of the ServiceDefinition file, setting it to use a single thread resolve this issue.

Hope this helps somebody, as I spent a day trying to troubleshoot this.

4 comments:

  1. This solved the issue for me, thanks a bunch! :)

    ReplyDelete
  2. Two years later and the issue still strikes back ;-) Thanks a lot for posting, I guess I would spend a day on it too!

    ReplyDelete
  3. Hey Kornel, Which actual file did you do the changes in as I have the same issue.

    thanks
    Russ

    ReplyDelete
  4. Nice Post! Thank you so much for sharing this one really well defined all peaceful info regarding Ecommerce,well really like it,Keep it up Love it- ecommerce Solutions

    ReplyDelete