8

Before upgrading to 1.8 (Oct 2012) this is how we configured our sites in the ServiceDefinition.

<Site name="Admin" physicalDirectory="..\Company.Admin">
  <Bindings>
    <Binding name="AdminBindingHttp" endpointName="HttpEndpoint" hostHeader="admin.company.com" />
  </Bindings>
</Site>

After we upgraded I was getting the following error when trying to publish.

Error 125 Cannot find the physical directory 'C:\Users\Me\Code\Company.Cloud\bin\Company.Admin' for virtual path Admin/.

We had to update the physicalDirectory value and move up 2 more folders.

<Site name="Admin" physicalDirectory="..\..\..\Company.Admin">
  <Bindings>
    <Binding name="AdminBindingHttp" endpointName="HttpEndpoint" hostHeader="admin.company.com" />
  </Bindings>
</Site>

It seems that previous to 1.8 Azure was executing in context of the original location of the csdef file but now it's executing from the bin\Release\ServiceDefinition.csdef which is 2 folders deeper.

I've been unsuccessful at finding a tutorial online that specifically talks about this feature used with the latest SDK version. Was this an official change? I should also mention that we also upgraded to VS 2012 at the same time.

I feel like this feature is constantly neglected. (See lack of .config transforms issue). We would love to switch to Azure WebSites but we're unable to do so until SSL/HTTPS is available and it is out of preview.

Vyrotek
  • 5,356
  • 5
  • 45
  • 70
  • 2
    I encountered this as well, and came to the same fix. I was already running VS2012 (RC, and then RTM), so it's not to do with that. – Jude Fisher Nov 13 '12 at 17:20
  • I am facing the same problem. But after appending "../" in virtual directory path, when i make pacakge. ServiceDefination.csdef file is modified outside and "../" gets removed and getting the same error "physical path to virtualdirectory not found." – sudhansu63 Nov 16 '12 at 06:50

2 Answers2

9

Yes, this was an official change, but I can't find any documentation about it other than what is contained in the upgrade report:

"The physicalDirectory attribute '..\MyWebRole' 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."

ccoxtn
  • 1,492
  • 2
  • 12
  • 14
  • Thank you for confirming this! – Vyrotek Nov 14 '12 at 18:43
  • Problem is, that this is different that what is on the Virtual Machine when deployed. The directory on the virtual machine is c:/a/Project on my machine it is c:/Project oh microsft.. – Ray Suelzer Sep 24 '13 at 01:45
2

In reply to sudhAnsu63's issue, I had the same problem where I would update the physicalDirectory attribute but it would reload the file and revert back to the old (now incorrect) configuration. I still don't understand why, but I noticed that VS would sometimes open multiple versions of the same file. I had to close all other files, make my edits, save and close the file, then it finally took my edits and started working. I believe editing the file externally to VS (like in notepad) might work. Oddly, once I got it working once, it does not seem to suffer this problem anymore.