Question

Martin Öbrink-Hansen on Tue, 03 Sep 2013 19:11:38


Hi,

I'm continuing a conversation with David Ebbo on Twitter here. link 

twitter.com / martinobrink / status / 374763831425511424 (I'm not allowed to post links apparently)

My problem is that when deploying an MVC 4 Web API solution (target .NET 4.5) to Azure Web Sites using the git auto deploy feature from a repository on GitHub, I have have to manually re-deploy or do a no-op commit in order to make NuGet package restore work and successfully deploy the solution Azure Web Sites.

The GitHub repo is located at github.com / martinobrink / AzurePlayground (I'm not allowed to post links apparently)

When deploying this repo to an Azure Web Site from master in repo, I get the following errors in the deployment build log output pasted at the bottom of this post. And then after doing a manual redeployment from the Azure web interface (no new commits in the repo), the deployment succeeds.

The problem seems to be related to any time the is a "package configuration change", then I need the extra re-deployment.

Any help on this? Or should I just wait for Azure Web Sites support of the new NuGet 2.7 auto package restore in order to abandon the MSBuild-version?

Hope you are able help on this matter. Feel free to use my public repo for your testing.

Best Regards 

Martin.

Build Log output below this:

Generating deployment script:
----------------------------


Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\repository" -o "C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\deployments\tools" --aspWAP "C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\repository\SimpleWebApiService\SimpleWebApiService\SimpleWebApiService.csproj" --solutionFile "C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\repository\SimpleWebApiService\SimpleWebApiService.sln"'.

Project file path: .\SimpleWebApiService\SimpleWebApiService\SimpleWebApiService.csproj

Solution file path: .\SimpleWebApiService\SimpleWebApiService.sln

Generating deployment script for .NET Web Application

Generated deployment script files



^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------------------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Running deployment command:
---------------------------



Command: C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\deployments\tools\deploy.cmd

Handling .NET Web Application deployment.

  Restoring NuGet packages...

  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.

  Installing 'elmah.io 1.0.0.16'.

  Installing 'jQuery.Validation 1.11.1'.

  Installing 'jQuery.UI.Combined 1.10.3'.

  Installing 'elmah.corelibrary 1.2.2'.

  Installing 'knockoutjs 2.3.0'.

  Installing 'EntityFramework 5.0.0'.

  Installing 'jQuery 2.0.3'.

  Installing 'Antlr 3.4.1.9004'.

  Installing 'Microsoft.AspNet.Mvc 4.0.30506.0'.

  Successfully installed 'knockoutjs 2.3.0'.

  Successfully installed 'elmah.corelibrary 1.2.2'.

  Successfully installed 'Antlr 3.4.1.9004'.

  Successfully installed 'jQuery.Validation 1.11.1'.

  Successfully installed 'jQuery 2.0.3'.

  Successfully installed 'Microsoft.AspNet.Mvc 4.0.30506.0'.

  Successfully installed 'elmah.io 1.0.0.16'.

  Installing 'Microsoft.AspNet.Providers.Core 1.2'.

  Installing 'Microsoft.AspNet.Razor 2.0.30506.0'.

  Installing 'Microsoft.AspNet.Providers.LocalDb 1.1'.

  Installing 'Microsoft.AspNet.Mvc.FixedDisplayModes 1.0.1'.

  Installing 'Microsoft.AspNet.Web.Optimization 1.1.0'.

  Successfully installed 'EntityFramework 5.0.0'.

  Installing 'Microsoft.AspNet.WebApi 4.0.30506.0'.

  Installing 'Microsoft.AspNet.WebApi.Client 4.0.30506.0'.

  Installing 'Microsoft.AspNet.WebApi.Core 4.0.30506.0'.

  Successfully installed 'Microsoft.AspNet.WebApi 4.0.30506.0'.

  Successfully installed 'Microsoft.AspNet.Providers.Core 1.2'.

  Successfully installed 'Microsoft.AspNet.Mvc.FixedDisplayModes 1.0.1'.

  Successfully installed 'Microsoft.AspNet.Providers.LocalDb 1.1'.

  Successfully installed 'Microsoft.AspNet.Web.Optimization 1.1.0'.

  Successfully installed 'Microsoft.AspNet.Razor 2.0.30506.0'.

  Successfully installed 'jQuery.UI.Combined 1.10.3'.

  Installing 'Microsoft.AspNet.WebApi.HelpPage 4.0.30506'.

  Successfully installed 'Microsoft.AspNet.WebApi.Client 4.0.30506.0'.

  Successfully installed 'Microsoft.AspNet.WebApi.Core 4.0.30506.0'.

  Installing 'Microsoft.AspNet.WebApi.OData 4.0.30506'.

  Installing 'Microsoft.AspNet.WebPages 2.0.30506.0'.

  Installing 'Microsoft.AspNet.WebApi.Tracing 4.0.30506'.

  Installing 'Microsoft.AspNet.WebApi.WebHost 4.0.30506.0'.

  Installing 'Microsoft.Bcl 1.1.3'.

  Installing 'Microsoft.Data.Edm 5.6.0'.

  Installing 'Microsoft.Bcl.Build 1.0.10'.

  Installing 'Microsoft.Data.OData 5.6.0'.

  Installing 'Microsoft.jQuery.Unobtrusive.Ajax 2.0.30506.0'.

  Successfully installed 'Microsoft.AspNet.WebApi.Tracing 4.0.30506'.

  Successfully installed 'Microsoft.AspNet.WebApi.HelpPage 4.0.30506'.

  Successfully installed 'Microsoft.AspNet.WebApi.WebHost 4.0.30506.0'.

  Successfully installed 'Microsoft.AspNet.WebApi.OData 4.0.30506'.

  Successfully installed 'Microsoft.AspNet.WebPages 2.0.30506.0'.

  Successfully installed 'Microsoft.Bcl.Build 1.0.10'.

  Successfully installed 'Microsoft.jQuery.Unobtrusive.Ajax 2.0.30506.0'.

  Installing 'Microsoft.jQuery.Unobtrusive.Validation 2.0.30506.0'.

  Installing 'Newtonsoft.Json 5.0.6'.

  Installing 'Microsoft.Net.Http 2.2.13'.

  Installing 'Microsoft.Web.Infrastructure 1.0.0.0'.

  Installing 'System.Spatial 5.6.0'.

  Installing 'Modernizr 2.6.2'.

  Successfully installed 'Microsoft.jQuery.Unobtrusive.Validation 2.0.30506.0'.

  Successfully installed 'Microsoft.Data.Edm 5.6.0'.

  Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.

  Installing 'WebGrease 1.5.2'.

  Successfully installed 'Modernizr 2.6.2'.

  Successfully installed 'WebGrease 1.5.2'.

  Successfully installed 'Microsoft.Bcl 1.1.3'.

  Successfully installed 'Newtonsoft.Json 5.0.6'.

  Successfully installed 'Microsoft.Net.Http 2.2.13'.

  Successfully installed 'System.Spatial 5.6.0'.

  Successfully installed 'Microsoft.Data.OData 5.6.0'.

C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\repository\SimpleWebApiService\SimpleWebApiService\SimpleWebApiService.csproj(349,5): error : The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568.

An error has occurred during web site deployment.

Handling .NET Web Application deployment.
  Restoring NuGet packages...
  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
  Installing 'elmah.io 1.0.0.16'.
  Installing 'jQuery.Validation 1.11.1'.
  Installing 'jQuery.UI.Combined 1.10.3'.
  Installing 'elmah.corelibrary 1.2.2'.
  Installing 'knockoutjs 2.3.0'.
  Installing 'EntityFramework 5.0.0'.
  Installing 'jQuery 2.0.3'.
  Installing 'Antlr 3.4.1.9004'.
  Installing 'Microsoft.AspNet.Mvc 4.0.30506.0'.
  Successfully installed 'knockoutjs 2.3.0'.
  Successfully installed 'elmah.corelibrary 1.2.2'.
  Successfully installed 'Antlr 3.4.1.9004'.
  Successfully installed 'jQuery.Validation 1.11.1'.
  Successfully installed 'jQuery 2.0.3'.
  Successfully installed 'Microsoft.AspNet.Mvc 4.0.30506.0'.
  Successfully installed 'elmah.io 1.0.0.16'.
  Installing 'Microsoft.AspNet.Providers.Core 1.2'.
  Installing 'Microsoft.AspNet.Razor 2.0.30506.0'.
  Installing 'Microsoft.AspNet.Providers.LocalDb 1.1'.
  Installing 'Microsoft.AspNet.Mvc.FixedDisplayModes 1.0.1'.
  Installing 'Microsoft.AspNet.Web.Optimization 1.1.0'.
  Successfully installed 'EntityFramework 5.0.0'.
  Installing 'Microsoft.AspNet.WebApi 4.0.30506.0'.
  Installing 'Microsoft.AspNet.WebApi.Client 4.0.30506.0'.
  Installing 'Microsoft.AspNet.WebApi.Core 4.0.30506.0'.
  Successfully installed 'Microsoft.AspNet.WebApi 4.0.30506.0'.
  Successfully installed 'Microsoft.AspNet.Providers.Core 1.2'.
  Successfully installed 'Microsoft.AspNet.Mvc.FixedDisplayModes 1.0.1'.
  Successfully installed 'Microsoft.AspNet.Providers.LocalDb 1.1'.
  Successfully installed 'Microsoft.AspNet.Web.Optimization 1.1.0'.
  Successfully installed 'Microsoft.AspNet.Razor 2.0.30506.0'.
  Successfully installed 'jQuery.UI.Combined 1.10.3'.
  Installing 'Microsoft.AspNet.WebApi.HelpPage 4.0.30506'.
  Successfully installed 'Microsoft.AspNet.WebApi.Client 4.0.30506.0'.
  Successfully installed 'Microsoft.AspNet.WebApi.Core 4.0.30506.0'.
  Installing 'Microsoft.AspNet.WebApi.OData 4.0.30506'.
  Installing 'Microsoft.AspNet.WebPages 2.0.30506.0'.
  Installing 'Microsoft.AspNet.WebApi.Tracing 4.0.30506'.
  Installing 'Microsoft.AspNet.WebApi.WebHost 4.0.30506.0'.
  Installing 'Microsoft.Bcl 1.1.3'.
  Installing 'Microsoft.Data.Edm 5.6.0'.
  Installing 'Microsoft.Bcl.Build 1.0.10'.
  Installing 'Microsoft.Data.OData 5.6.0'.
  Installing 'Microsoft.jQuery.Unobtrusive.Ajax 2.0.30506.0'.
  Successfully installed 'Microsoft.AspNet.WebApi.Tracing 4.0.30506'.
  Successfully installed 'Microsoft.AspNet.WebApi.HelpPage 4.0.30506'.
  Successfully installed 'Microsoft.AspNet.WebApi.WebHost 4.0.30506.0'.
  Successfully installed 'Microsoft.AspNet.WebApi.OData 4.0.30506'.
  Successfully installed 'Microsoft.AspNet.WebPages 2.0.30506.0'.
  Successfully installed 'Microsoft.Bcl.Build 1.0.10'.
  Successfully installed 'Microsoft.jQuery.Unobtrusive.Ajax 2.0.30506.0'.
  Installing 'Microsoft.jQuery.Unobtrusive.Validation 2.0.30506.0'.
  Installing 'Newtonsoft.Json 5.0.6'.
  Installing 'Microsoft.Net.Http 2.2.13'.
  Installing 'Microsoft.Web.Infrastructure 1.0.0.0'.
  Installing 'System.Spatial 5.6.0'.
  Installing 'Modernizr 2.6.2'.
  Successfully installed 'Microsoft.jQuery.Unobtrusive.Validation 2.0.30506.0'.
  Successfully installed 'Microsoft.Data.Edm 5.6.0'.
  Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
  Installing 'WebGrease 1.5.2'.
  Successfully installed 'Modernizr 2.6.2'.
  Successfully installed 'WebGrease 1.5.2'.
  Successfully installed 'Microsoft.Bcl 1.1.3'.
  Successfully installed 'Newtonsoft.Json 5.0.6'.
  Successfully installed 'Microsoft.Net.Http 2.2.13'.
  Successfully installed 'System.Spatial 5.6.0'.
  Successfully installed 'Microsoft.Data.OData 5.6.0'.
C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\repository\SimpleWebApiService\SimpleWebApiService\SimpleWebApiService.csproj(349,5): error : The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568.
An error has occurred during web site deployment.
D:\kuduservice\wwwroot\bin\scripts\starter.cmd C:\DWASFiles\Sites\myplayground\VirtualDirectory0\site\deployments\tools\deploy.cmd

---------------------------

Sponsored



Replies

pranavkm on Tue, 03 Sep 2013 22:40:38


The problem is that the Microsoft.Bcl.Build package includes a MsBuild target and the only way to make it load the target restored by NuGet is to re-run MsBuild (See this post). 
A workaround for this problem would be to have a custom deployment script that runs restore prior to building. 
    
1) Ensure you're running the NuGet v2.7 or higher (nuget.exe update -self)
2) Create a custom deployment script

The build arguments you're looking for something should look like this:

azure site deploymentscript -y --no-dot-deployment --aspWAP "SimpleWebApiService\SimpleWebApiService\SimpleWebApiService.csproj" --solutionFile "SimpleWebApiService\SimpleWebApiService.sln"

3) Update the deploy.cmd to explicitly restore as the first step:

.nuget\nuget.exe restore SimpleWebApiService\SimpleWebApiService.sln

In our upcoming release, we are adding support for NuGet restore as part of Git deployment which would allow you to not bother with any of this. 


David Ebbo on Wed, 04 Sep 2013 04:24:05


Ah yes, Pranav is correct here, and luckily, within a week or two, this issue will go away on its own.

You can do the custom deployment script, but there is a bit of pain involved, so maybe you're better off waiting. I think a simple workaround you can use for now is to go to the Deployment tab on the Azure portal and click the Redeploy button at the bottom.

Martin Öbrink-Hansen on Fri, 06 Sep 2013 17:39:10


Sorry for the late reply.

Thank you very much to the both of you for your comments.

I have marked both your comments as solution, since I'm sure the more cumbersome solution from pranavkm would solve my problem so that I wouldn't have to manually redeploy using the button on the Azure management website. But since it's just weeks away with the Azure/git/auto restore solution, I'll just manually click the button when needed until then.

Once again, thanks for your time!

Best regards Martin.