0
votes

I have a classic Cloud Services project that has multiple websites on a single service, configured in ServiceDefinition.csdef like so:

<WebRole name="PE.Roles.API" vmsize="Small">
    <Sites>
      <Site name="API" physicalDirectory="..\..\..\PE.Roles.API">
        <Bindings>
          <Binding name="http" endpointName="PE.API" />
        </Bindings>
      </Site>
      <Site name="PE.Services.Authorization" physicalDirectory="..\..\..\PE.Services.Authorization">
        <Bindings>
          <Binding name="http" endpointName="PE.Services.Authorization" />
        </Bindings>
      </Site>
    <!-- Etc -->
    </Sites>
</WebRole>

This compiles and packages correctly in Visual Studio 2015, and deploys without a problem from a precompiled .cspkg file to the Cloud Service.

We have recently moved to Visual Studio Team Services for DevOps, and I'm trying to set this solution up to build and deploy in the cloud, using the provided Azure Cloud Services build template.

The .sln build step completes correctly, but the .ccproj build step fails with the following error:

PE.Azure\bin\ServiceDefinition.csdef (0, 0)
PE.Azure\bin\ServiceDefinition.csdef(0,0): Error CloudServices079: Cannot find the physical directory 'D:\a\1\PE.Roles.API' for virtual path API/.
Process 'msbuild.exe' exited with code '1'.

My build arguments are: /t:Publish /p:TargetProfile=$(targetProfile) /p:DebugType=None /p:SkipInvalidConfigurations=true /p:OutputPath=bin\ /p:PublishDir="$(build.artifactstagingdirectory)\\"

I've found a number of blog posts and SO questions covering similar issues, but nothing that addresses this precisely (and nothing posted in the last few years).

Update

I've created a TFVC repo for the project and implemented the mapping step, as suggested below:

enter image description here

...but I still get the same error: enter image description here

What do I need to do to get this working?

1
I had this question few years ago stackoverflow.com/questions/16869047/… at that time I ended up with manual publish i think. later MS said it is supported in VS 2015 visualstudio.uservoice.com/forums/330519-team-services/… but the link given is a 404 now. as such web apps are the popular ones these days than webroles.Aravind
Thanks. We're stuck with webroles for the time being. I did see your question, but I was hoping MS might have implemented this in the last four years.Jude Fisher
You might have seen this post too. it says the code base is latest. but it does not really talk about VSO though.. azure.microsoft.com/en-in/resources/samples/…Aravind

1 Answers

2
votes

You need to modify source mapping per to the setting of physicalDirectory.

Refer to this sample to modify it:

<Site name="API" physicalDirectory="..\..\..\WebGeneralDemo">
        <Bindings>
          <Binding name="http" endpointName="WebGeneralDemo" />
        </Bindings>
      </Site>

enter image description here

Update:

If these projects are in a git repository, you can keep the structure in repository like this:

-Repo

--AzureCloudServiceDemo

---AzureCloudServiceDemo

---WebRole1

--WebGeneralDemo

If the structure isn't like this, you can copy folders (include files) by using Copy file task

Update

In the case of this specific question, the original structure of the Repo was as follows:

enter image description here

... where the .ccproj file is in the PE.Azure folder, and the site being published is in the PE.Roles.API folder.

The compiler was looking for the site content in the directory one above the $(build.sourcesDirectory) (so D:\a\1\), so the correct Copy File task to fix the error was: enter image description here

A Copy Files task was required for each site, and the tasks had to be positioned after the Build Solution ***.sln step, but before the Build Solution ***.ccproj step.