【问题标题】:ASP.NET Core Migration from 2.1 -> 2.2 Issue with dependencies in Azure deploymentASP.NET Core 从 2.1 迁移 -> 2.2 Azure 部署中的依赖项问题
【发布时间】:2019-05-11 03:45:52
【问题描述】:

我在将 ASP.NET Core 2.2 应用程序部署到 Azure 时遇到了 Kudu 问题。该应用程序是从 2.1 -> 2.2 迁移的,并且在升级之前部署得很好。

我用这个document 作为参考

部署错误日志:

    Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
  Restoring packages for D:\home\site\repository\Source\PlanetDiego.Core\PlanetDiego.Core.csproj...
D:\Program Files (x86)\dotnet\sdk\2.2.100\NuGet.targets(114,5): error : Could not find file 'D:\home\.nuget\newtonsoft.json\6.0.4\newtonsoft.json.6.0.4.nupkg'. [D:\home\site\repository\Source\PlanetDiego.sln]
Failed exitCode=1, command=dotnet restore "D:\home\site\repository\Source\PlanetDiego.sln"
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"

有趣的是,每次部署尝试都会返回不同的错误依赖错误:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
  Restoring packages for D:\home\site\repository\Source\PlanetDiego.Core\PlanetDiego.Core.csproj...
D:\Program Files (x86)\dotnet\sdk\2.2.100\NuGet.targets(114,5): error : Could not find file 'D:\home\.nuget\awssdk.core\3.3.0\awssdk.core.3.3.0.nupkg'. [D:\home\site\repository\Source\PlanetDiego.sln]
Failed exitCode=1, command=dotnet restore "D:\home\site\repository\Source\PlanetDiego.sln"
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"

csproj 文件。如您所见,不依赖于 newtonsoft.json.6.0.4.nupkg 或 awssdk.core.3.3.0.nupkg。指定的版本分别为 12.0.1 和 3.3.29。 我尝试转到 Azure 中的 Kudu 控制台并删除 D:\home\site\deployments\tools 文件夹中的 deploy.cmd 和 deploymentCacheKey。可惜没有效果。

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <AssemblyName>PlanetDiego.Core</AssemblyName>
    <PackageId>PlanetDiego.Core</PackageId>
    <LangVersion>latest</LangVersion>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AWSSDK.Core" Version="3.3.29.13" />
    <PackageReference Include="AWSSDK.S3" Version="3.3.31" />
    <PackageReference Include="AWSSDK.SimpleEmail" Version="3.3.7.15" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="TweetinviAPI" Version="4.0.0" />
  </ItemGroup>

</Project>

【问题讨论】:

标签: c# azure azure-web-app-service azure-deployment asp.net-core-2.2


【解决方案1】:

似乎我能够在 Visual Studio Code 中部署具有目标框架 2.1 和 Azure 工具扩展的应用程序。 dotnet publish -c Relase,然后右键单击 bin/Release/netcoreapp2.1/publish 文件夹并部署到 Web 应用程序。

SDK 2.2 是new,现在可能在 Azure 上坏了。

【讨论】:

  • 是的,我已经在 Azure 上部署了几个 2.1 应用程序,没有任何问题。我相信自 12 月 6 日起 Azure 正式支持 2.2 SDK。但是,通过 Githib 或 Bitbucket 部署时,包还原失败。
  • 是的,我也有同样的问题。所以,我建议你可以去GitHub开一个issue来检查sdk是否有问题?
  • 查看我原来帖子的评论。似乎已经有一张未公开的票。谢谢。
【解决方案2】:

尝试删除D:\home\.nuget\ 目录,然后重新运行恢复/部署。

【讨论】:

  • 谢谢,成功了!这成功地重新映射到正确的包。我还必须将它作为 Outofprocess OutOfProcess 运行以使其工作。
猜你喜欢
  • 2019-06-19
  • 1970-01-01
  • 2020-04-22
  • 2019-06-28
  • 1970-01-01
  • 2020-05-27
  • 2019-11-12
  • 2019-03-06
  • 1970-01-01
相关资源
最近更新 更多