Why is Azure Add > Worker role project in solution … greyed out in VS2010?

I have a C# .Net 4 class library that I think I have set up to be an Azure Worker Role, i.e. the class implements Microsoft.WindowsAzure.ServiceRuntime.RoleEntryPoint and has a Run() and an OnStart() method. However when I right-click on the Roles folder in my empty Windows Azure project and click Add the option to add a "Worker role project in solution …" is greyed out. What do I need to do for VS2010 to realise there's a potential worker role project in the solution?


The "Add > Worker Role Project in solution..." only displays worker role projects not class libraries. Even though they look the same, they aren't.

You can create a worker role project by using the following:

  • When creating a new cloud project

  • By right clicking a cloud project

Then you'll be able to add that worker role project in an other cloud project if you like. In that case the "Add > Worker Role Project in solution..." menu option will be enabled.

Now, you can also 'convert' a class library to a worker role project. Right click the class library and choose Unload Project .. then (once that's unloaded), Edit Project File and add the RoleType element in the first property group:

   <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
   <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
   <RoleType>Worker</RoleType>  <-------------------- HERE

Finally - reload the project back into the solution -> Right-Click Reload Project. (NOTE: if the Xml file is still open, you'll get asked to close it.. which is perfect. Say yes and close it). .. Now your class library has been re-added back but it's a Worker Role Class Library.

If you do this, Visual Studio will recognize the project as being a worker role and you'll be able to add it to the cloud project:

Note: Your class library will need a class deriving from RoleEntryPoint. More information: http://blogs.msdn.com/b/jnak/archive/2010/02/11/windows-azure-roleentrypoint-method-call-order.aspx

Need Your Help

When do you use "apply" and when "funcall"?


The Common Lisp HyperSpec says in the funcall entry that

disable all page elements with modal feature using jquery

javascript jquery html css modal-dialog

I wish to disable all page elements upon an action. Like the modal feature that is in the JQuery UI.