Cloud Service Project Templates vs Role Project Templates

If you create a new Cloud Service project in Visual Studio but it doesn't contain a Cloud Service project (ccproj), you won't get the Visual Studio integration for building Windows Azure services that you would expect.  For example, you won't get debug/run in the Development Fabric, you won't get integration with the Development Storage service, and you won't get publishing support.

The reason is that you have created a Role project, instead of a Cloud Service Project. Today, you can have 0 or 1 Web Roles (which is an ASP.Net Web Application) and 0 or 1 Worker Roles (which is a UI-less .Net application) in each service.

When you create a new Cloud Service project, make sure you are choosing a template from the "Cloud Service" node and not the Roles node in the New Project dialog:

image

The question would then be, what is the Roles node in the New Project dialog used for?

It's used when you want to:

1) Add a role to an existing Cloud Service project.  For example, the following Cloud Service project contains a web role.  You can use the roles node to add a Worker Role project to that Cloud Service.

image

This will bring up the new project dialog with the Roles node selected.  Out of the box, we only support C# and VB ASP.Net Web Application Web Roles and and C# and VB Worker roles.

image

Likewise, if the Cloud Service contains a Worker Role and not a Web Role, you can add a Web Role to that project in the same way.

2) Replace an existing Role with a new Role Project.  For example, you have a Cloud Service that contains a Web Role, and you want to replace it with a new Web Role.  You can right click on the Web Role association and select to associate it with a new Web Role:

image

This will bring up the the new project dialog with the Roles node selected:

image 

The final thing you can do, is associate a role with an existing Role project by adding that Role project to the solution, right clicking on either the Web or Worker role association node in Solution Explorer and select to associate that role with a "Role Project in solution..."