Windows Azure Tools: Getting the right Run/Debug and Publish Functionality

If you're using the Windows Azure Tools for Microsoft Visual Studio and you are finding that when you hit F5 or Ctrl+F5 you are getting the ASP.Net Development server:

image

Instead of the Development Fabric and Development Storage services:

image image

You need to make sure that the startup project in Visual Studio is set to the ccproj that was added when you created a Cloud Service.  Notice below how the CloudService22 project is bold, which indicates that it is the startup project.

image

You can set the startup project by right clicking on a project and selecting "Set as StartUp Project":

image

A useful setting to look at it in the Solution property pages (right click on the solution node in the Solution Explorer and click "Properties") is the Common Properties -> Startup Project.

image

Having this set to "Single startup project" and selecting the Cloud Service (ccproj) project is the way to go.  Having it set to the "Current Selection" causes the startup project to change whenever you activate a file in a different project.

Cloud Service projects should have this set to a single startup project already.

If you don't have a Cloud Service project in your solution, make sure that when you created your Cloud Service project, that you selected a template from the Cloud Service node and not the Roles node in the New Project -> Project types dialog:

image

See my post on the different between Cloud Service and Role Templates for more information.

A Related Note on Publish

When hitting "Publish" to create the cspkg file that you upload to the Azure Services Development Portal to deploy your Cloud Service on Windows Azure, you need to make sure that you publish on the Cloud Service project and not the Web Role.

image

Otherwise you'll get this dialog, which is not what you want when working on Windows Azure services:

image

This can be especially confusing when you use the Build -> Publish option:

image 

This is context sensitive to the selected project (not startup project) -- so just make sure the name to the right of the Publish action corresponds to the name of your Cloud Service project.