Kudu: After adding SDK 2.2 kudu deployment from github is broken - dotnet restore fails

Created on 10 Dec 2018  路  5Comments  路  Source: projectkudu/kudu

Repro steps.

run dotnet restore in kudu.

After adding SDK 2.2 kudu is unable to deploy Web Apps from GitHub. Changing target framework back to 2.1 doesn't help and builds keep failing. I'm able to restore and build the Web App locally on both Mac OS and Windows. I'm able to deploy it to Azure via Visual Studio and Azure Tools in Visual Studio Code.

Project structures.

Here is the Web.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext> 
    <AssemblyName>Web</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>Web</PackageId>
  </PropertyGroup>

  <ItemGroup>
    <None Update="wwwroot\**\*;Views\**\*;Areas\Admin\Views\**\*">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0-beta1" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.*" PrivateAssets="All" />
    <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="System.Xml.XPath" Version="4.3.0" />
    <PackageReference Include="Flurl" Version="2.8.0" />
    <PackageReference Include="Flurl.Http" Version="2.4.0" />
    <PackageReference Include="ChyImageProcessorCore" Version="1.0.0-*" />
    <PackageReference Include="Postmark" Version="*" />
    <PackageReference Include="EPPlus.Core" Version="*" />
    <PackageReference Include="RavenSharp.Core" Version="*" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="*" />
  </ItemGroup>
</Project>

Kudu console returns following SDKs:

> dotnet --list-sdks
D:\home\site\wwwroot
1.1.10 [D:\Program Files (x86)\dotnet\sdk]
2.1.403 [D:\Program Files (x86)\dotnet\sdk]
2.1.500 [D:\Program Files (x86)\dotnet\sdk]
2.2.100 [D:\Program Files (x86)\dotnet\sdk]

The log/error given by the failure.

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
  Restoring packages for D:\home\site\repository\Web.csproj...
D:\Program Files (x86)\dotnet\sdk\2.2.100\NuGet.targets(114,5): error : Could not find file 'D:\home\.nuget\runtime.win7-x86.runtime.native.system.data.sqlclient.sni\4.0.1\runtime.win7-x86.runtime.native.system.data.sqlclient.sni.4.0.1.nupkg'. [D:\home\site\repository\Web.csproj]
Failed exitCode=1, command=dotnet restore "D:\home\site\repository\Web.csproj"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\79.11121.3655\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

Debug your Azure website remotely.

Subscription ID: c12dd808-5bb3-4c95-88c0-f60f64ee9db1

Mention any other details that might be useful.

The issue can be reproduced by simply running restore command from Azure console:

> cd \home\site\repository
D:\home\site\repository
> dotnet restore
D:\home\site\repository
Restoring packages for D:\home\site\repository\Web.csproj...
D:\Program Files (x86)\dotnet\sdk\2.2.100\NuGet.targets(114,5): error : Could not find file 'D:\home\.nuget\runtime.win7-x86.runtime.native.system.data.sqlclient.sni\4.0.1\runtime.win7-x86.runtime.native.system.data.sqlclient.sni.4.0.1.nupkg'. [D:\home\site\repository\Web.csproj]

Adding NuGet.config doesn't help nor dotnet restore --no-cache --force command.

Changing target framework doesn't help

Changing framework back to <TargetFramework>netcoreapp2.1</TargetFramework> doesn't help. Kudu is stuck and tries to get packages from 2.2.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext> 
    <AssemblyName>Web</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>Web</PackageId>
  </PropertyGroup>

  <ItemGroup>
    <None Update="wwwroot\**\*;Views\**\*;Areas\Admin\Views\**\*">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0-beta1" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.*" PrivateAssets="All" />
    <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="System.Xml.XPath" Version="4.3.0" />
    <PackageReference Include="Flurl" Version="2.8.0" />
    <PackageReference Include="Flurl.Http" Version="2.4.0" />
    <PackageReference Include="ChyImageProcessorCore" Version="1.0.0-*" />
    <PackageReference Include="Postmark" Version="*" />
    <PackageReference Include="EPPlus.Core" Version="*" />
    <PackageReference Include="RavenSharp.Core" Version="*" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="*" />
  </ItemGroup>
</Project>
Restoring packages for D:\home\site\repository\Web.csproj...
D:\Program Files (x86)\dotnet\sdk\2.2.100\NuGet.targets(114,5): error : Could not find file 'D:\home\.nuget\runtime.win7-x86.runtime.native.system.data.sqlclient.sni\4.0.1\runtime.win7-x86.runtime.native.system.data.sqlclient.sni.4.0.1.nupkg'. [D:\home\site\repository\Web.csproj]

Thanks for any help you can provide.

Most helpful comment

I can confirm, Experiencing the same problem when deploying ASP.NET Core 2.2 from Bitbucket to Azure app services.
Details here

All 5 comments

I can confirm, Experiencing the same problem when deploying ASP.NET Core 2.2 from Bitbucket to Azure app services.
Details here

I was having this same issue. Deleting the D:\home\.nuget\ directory and then re-running the restore/deployment seems to have resolved it for me.

Same Problem here

I wasn't able to get new AppServices app into the broken state described here.

What TFM were you targeting before it failed? Did it start failing when you changed TFM?

I can confirm deleting D:\home.nuget\ fixes the issue.

1) https://XXXXXX.scm.azurewebsites.net/DebugConsole
2) Click delete (minus sign) for the .nuget folder
3) Go back to Azure Deployment Center and Sync the project
4) Success

Was this page helpful?
0 / 5 - 0 ratings