gpt4 book ai didi

c# - 将 ASP.NET Core 2.1 预览应用程序部署到 Azure

转载 作者:行者123 更新时间:2023-12-03 03:00:54 24 4
gpt4 key购买 nike

我正在尝试我的第一个 ASP.NET Core 2.1 预览应用程序,因此我从 VS 创建了一个新的 ASP.NET Core 2.1 预览应用程序(15.6 - 预览 7)。在 VS 下我的本地机器中一切运行正常。

然后,我在 Azure 上创建了一个新的应用服务,安装了 Preview1 扩展(如 here 所示)并使用我的 Git Repo 设置部署。

当我将代码从本地盒子推送到 Git 时,部署会启动,但我收到与运行时相关的错误:

NU1102: Unable to find package Microsoft.Build.Runtime with version (>= 15.7.0-preview-000011-1378327)].

我错过了什么吗?

控制台.net版本检查:

> dotnet --info

D:\home\site\wwwroot
.NET Command Line Tools (2.1.300-preview1-008174)
Product Information:
Version: 2.1.300-preview1-008174
Commit SHA-1 hash: b8df89a54f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x86
Base Path: D:\home\SiteExtensions\AspNetCoreRuntime\sdk\2.1.300-preview1-008174\
Microsoft .NET Core Shared Framework Host
Version : 2.1.0-preview1-26216-03
Build : f2c3216183d20416568a4bbf5bb7d153e826f153

部署错误:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restoring packages for D:\home\site\repository\MyApp\MyApp.csproj...
Restore completed in 450.06 ms for
D:\home\site\repository\MyApp\MyApp.csproj.
D:\home\site\repository\MyApp\MyApp.csproj : error NU1102: Unable to find
package Microsoft.Build.Runtime with version (>= 15.7.0-preview-000011-
1378327) [D:\home\site\repository\MyApp.sln]
D:\home\site\repository\MyApp\MyApp.csproj : error NU1102: - Found 17
version(s) in nuget.org [ Nearest version: 15.6.82 ]
[D:\home\site\repository\MyApp.sln]
Restore failed in 5.43 sec for D:\home\site\repository\MyApp\MyApp.csproj.
Failed exitCode=1, command=dotnet restore
"D:\home\site\repository\MyApp.sln"
An error has occurred during web site deployment.

最佳答案

我遇到了同样的问题,我通过回退到以下版本修复了它:

<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />

而不是:

<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.1.0-preview1-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.1.0-preview1-final" />

关于c# - 将 ASP.NET Core 2.1 预览应用程序部署到 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49097837/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com