8

I'm getting some strange errors from the build server in the CSPack step when build a Cloud Service (Web Role) project with the Publish target on a build server. Publish through Visual Studio 2012 works fine, but not on the build server.

Error reported by Team City:

[Azure\AzureAPI\AzureAPI.ccproj.teamcity] CorePublish 
[15:58:49][CorePublish] CorePublish: PackageWebRole = True 
[15:58:49][CorePublish] Publishing starting... 
[15:58:49][CorePublish] RolePlugins       is  
[15:58:49][CorePublish] Publishing to 'bin\Release\app.publish\' 
[15:58:49][CorePublish] MakeDir 
[15:58:49][CorePublish] TargetServiceDefinition is bin\Release\ServiceDefinition.csdef [15:58:49][CorePublish] TargetServiceConfiguration is bin\Release\ServiceConfiguration.cscfg 
[15:58:49][CorePublish] Roles is  
[15:58:49][CorePublish] CSPack 
[15:58:49][CSPack] D:\AzureAPI\bin\Release\ServiceDefinition.csdef error CloudServices077: 
Need to specify the physical directory for 
the virtual path 'Web/' of role Application.MyWebApi 

My ServiceDefinition file contains these settings for the site.

<WebRole name="Application.MyWebApi" vmsize="Small">
    <Sites>
      <Site name="Web">        
        <Bindings>
          <Binding name="Endpoint1" endpointName="www" />
        </Bindings>
      </Site>
    </Sites>
...
</WebRole

On the build server I have "Azure Authoring Tools v2.0" and the "Windows Azure Libraries for .NET 2.0".

Do I need to define the physical path when publishing on a build server, or are there any other scenarios that may cause this error?

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
John Korsnes
  • 2,277
  • 2
  • 20
  • 31

2 Answers2

3

I had the same issue but was able to fix it by adding more specific properties to the Command Line Properties section of the build step. The following additions prevented the error from showing and was able to correctly generate my .cspkg file:

/t:Publish
/p:TargetProfile=Cloud
/p:Configuration=Release
/p:Platform="Any CPU"
/p:PublishDir=bin\Release\app.publish
/p:OutputPath=bin\Release

Also, I changed the "Targets" field to the following: publish

From my understanding, that is the point of having /t:Publish as a command line property but in any case, the error does not appear in the build anymore.

My Stack Overfloweth
  • 4,729
  • 4
  • 25
  • 42
  • 2
    I think the changes you made to the command line parameters were a red herring. The thing that fixed it for me was changing the targets field to publish. Thanks a lot. – TylerD87 Feb 24 '16 at 09:27
1

I had a similar problem while wrestling with CSPack. I eventually stumbled on this article on MSDN titled: Command-Line Build for Azure

I changed my MSBuild CMD to:

WebAppPaaS\WebAppPaaS.sln /t:Publish /p:TargetProfile=Cloud

Using MSBuild at:

C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe

This resolved my build issues. I then deployed to Azure using PowerShell...

tripdubroot
  • 1,143
  • 5
  • 13