After recently upgrading one of my Windows Azure web role projects from Visual Studio 2012 and Azure SDK 1.7 to Visual Studio 2012 and Azure SDK 1.8, I started getting a strange error whenever I attempted to run and debug my Azure project in the local DEV fabric.

Cannot find the physical directory ‘C:\Workspaces\MyAzureSolution\MyAzureProject\bin\MyWebApp’ for virtual path MyWebApp/. C:\Workspaces\MyAzureSolution\MyAzureProject\bin\Debug\ServiceDefinition.csdef 1 1 MyAzureProject

Apparently, this is the result of a little-known change introduced in the 1.8 version of the Azure SDK. You are going to have to update the ServiceDefinition.csdef file of your Azure web role project to correct the issue. If your web role defines the site’s physicalDirectory attribute with a relative path you will need to update that value and point it 2 more directory levels higher.

Before Definition (SDK 1.7)

  <WebRole name="MyWebApp" vmsize="Small">
    ...
    <Sites>
      <Site name="MyWebApp" physicalDirectory="..\MyWebApp">
      ...
    </Sites>
    ...
  </WebRole>
									

After Definition (SDK 1.8)

  <WebRole name="MyWebApp" vmsize="Small">
    ...
    <Sites>
      <Site name="MyWebApp" physicalDirectory="..\..\..\MyWebApp">
      ...
    </Sites>
    ...
  </WebRole>
									

This change should fix the “cannot find the physical directory” issue when starting the debugger.