Cannot find the physical directory for virtual path, in Windows Azure project SDK 1.8

I have upgraded windows Azure SDK from V1.7 to V1.8

Before Upgradation part of my config was

<Site name="Web">
    <VirtualApplication name="MyprojectService"        physicalDirectory="../../Myproject.Hosts.WebHost" />

After Upgradation of SDK

I am getting following Error.

Error 1 Cannot find the physical directory
for virtual path
Web/MyprojectService/. D:ProjectsMyprojectbranchesRelease_092012HostsMyproject.Hosts.AzureHostMyprojectAzureHostbinReleaseServiceDefinition.csdef 1 1 MyprojectAzureHost

i have gone through the link Azure Service.Csdef.
and I appended “../”to the path:

<Site name="Web">
    <VirtualApplication name="MyprojectService"        physicalDirectory="../../../Myproject.Hosts.WebHost" />

but when i make a package it is getting removed automatically and i am getting the above error again and again.

I have also tried putting the Complete path “D:/Projects/../Myproject.Hosts.WebHost” but no lock.

It was perfectly working in SDK 1.7. but not working in SDK 1.8


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I will try to explain the changes in between two latest Windows Azure SDK (by using same sample app) as below so please have a look at each case and the path shown in the error message:

In previous SDK the virtual directory source was set to default at the root of the project however now in latest SDK the virtual directory source is set at project output directory which you can see in Case #1 below.

Case 1: (Failed)

<VirtualApplication name="MyWeb" physicalDirectory="MvcWebRole1">

Error: Cannot find the physical directory 
    'C:UsersavkashcDocumentsVisual Studio 2012ProjectsWindowsAzure2012WindowsAzure2012binReleaseMvcWebRole1' for virtual path Web/MyWeb/.

Case 2: (Failed)
 <VirtualApplication name="MyWeb"  physicalDirectory="..MvcWebRole1">

 Error: Cannot find the physical directory 'C:UsersavkashcDocumentsVisual Studio 2012ProjectsWindowsAzure2012WindowsAzure2012binMvcWebRole1' for virtual path Web/MyWeb/.

Case 3: (Failed)
 <VirtualApplication name="MyWeb"  physicalDirectory="....MvcWebRole1">

 Error: Cannot find the physical directory 'C:UsersavkashcDocumentsVisual Studio 2012ProjectsWindowsAzure2012WindowsAzure2012MvcWebRole1' for virtual path Web/MyWeb/.

Case 4: (Success)
 <VirtualApplication name="MyWeb"

Because above case #4 folder setting does match with my actual MvcWebRole1 folder structure (seen below) at thats why “……” setting does work in my “PhysicalDirectory” setting.

You would need to walk through your folder structure from release* as your source and then back track all the way where ever it exist and then assemble the full path.

enter image description here

Method 2

sudhAnsu63, Sorry this caused you trouble.

When upgrading a project that has relative paths in the csdef (as is the case here) to the 1.8 SDK you should see the warning below in the upgrade log about the change in relative path. This specific change was made to better support parallel builds.

The physicalDirectory attribute of the Site element contains a relative path. This path is relative to the directory in which the target Service Definition file resides when packaged. In previous versions this file was located within the root project directory. In this version, by default, this file is located in the project output directory. You may need to update the relative path to reflect the new location of the target Service Definition file.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x