Netcore 2.1.1版本导致应用程序无法运行 [英] Netcore 2.1.1 release leads to app failing to run

查看:348
本文介绍了Netcore 2.1.1版本导致应用程序无法运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎突然之间有些东西与asp.net核心软件包不同步.

It seems there is suddenly something out of sync with asp.net core packages.

Microsoft.AspNetCore.App 2.1.1 似乎是16小时前在nuget上发布的.org,但只有158次下载,显然我是其中一位下载器.

It looks like Microsoft.AspNetCore.App 2.1.1 was released 16 hours ago on nuget.org but only 158 downloads, and apparently I'm one of the downloaders.

我的.csproj文件是这样的:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\cloudscribe.Web.Navigation\cloudscribe.Web.Navigation.csproj" />
    <ProjectReference Include="..\cloudscribe.Web.SiteMap\cloudscribe.Web.SiteMap.csproj" />
    <ProjectReference Include="..\cloudscribe.Web.SiteMap.FromNavigation\cloudscribe.Web.SiteMap.FromNavigation.csproj" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.*" />
  </ItemGroup>
</Project>

它可以构建,但是当我尝试运行它时,我得到:

It builds but when I try to run it I get:

找不到任何兼容的框架版本 找不到指定的框架'Microsoft.AspNetCore.App'版本'2.1.1'. -检查应用程序依赖性并确定安装在以下位置的框架版本: C:\ Program Files \ dotnet \ -安装.NET Core必备软件可能有助于解决此问题: http://go.microsoft.com/fwlink/?LinkID=798306&clcid = 0x409 -.NET Core框架和SDK可以从以下位置安装: https://aka.ms/dotnet-download -已安装以下版本: 2.1.0位于[C:\ Program Files \ dotnet \ shared \ Microsoft.AspNetCore.App]

It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found. - Check application dependencies and target a framework version installed at: C:\Program Files\dotnet\ - Installing .NET Core prerequisites might help resolve this problem: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 - The .NET Core framework and SDK can be installed from: https://aka.ms/dotnet-download - The following versions are installed: 2.1.0 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]

如果我将Microsoft.AspNetCore.App的版本更改为2.1.0并进行dotnet还原,则会得到以下信息:

If I change my version for Microsoft.AspNetCore.App to 2.1.0 and do dotnet restore I get this:

C:_c \ cloudscribe.Web.Navigation \ src \ NavigationDemo.Web \ NavigationDemo.Web.csproj:错误NU1107:为Microsoft.AspNetCore.Antiforgery检测到版本冲突.直接从项目中引用该软件包以解决此问题. C:_c \ cloudscribe.Web.Navigation \ src \ NavigationDemo.Web \ NavigationDemo.Web.csproj:错误NU1107:NavigationDemo.Web-> cloudscribe.Web.Navigation-> Microsoft.AspNetCore.Mvc.Razor 2.1.1-> Microsoft .AspNetCore.Mvc.ViewFeatures 2.1.1-> Microsoft.AspNetCore.Antiforgery(> = 2.1.1) C:_c \ cloudscribe.Web.Navigation \ src \ NavigationDemo.Web \ NavigationDemo.Web.csproj:错误NU1107:NavigationDemo.Web-> Microsoft.AspNetCore.App 2.1.0-> Microsoft.AspNetCore.Antiforgery(= 2.1.0 ). 对于C:_c \ cloudscribe.Web.Navigation \ src \ NavigationDemo.Web \ NavigationDemo.Web.csproj,还原在3.54秒内失败.

C:_c\cloudscribe.Web.Navigation\src\NavigationDemo.Web\NavigationDemo.Web.csproj : error NU1107: Version conflict detected for Microsoft.AspNetCore.Antiforgery. Reference the package directly from the project to resolve this issue. C:_c\cloudscribe.Web.Navigation\src\NavigationDemo.Web\NavigationDemo.Web.csproj : error NU1107: NavigationDemo.Web -> cloudscribe.Web.Navigation -> Microsoft.AspNetCore.Mvc.Razor 2.1.1 -> Microsoft.AspNetCore.Mvc.ViewFeatures 2.1.1 -> Microsoft.AspNetCore.Antiforgery (>= 2.1.1) C:_c\cloudscribe.Web.Navigation\src\NavigationDemo.Web\NavigationDemo.Web.csproj : error NU1107: NavigationDemo.Web -> Microsoft.AspNetCore.App 2.1.0 -> Microsoft.AspNetCore.Antiforgery (= 2.1.0). Restore failed in 3.54 sec for C:_c\cloudscribe.Web.Navigation\src\NavigationDemo.Web\NavigationDemo.Web.csproj.

我想部分原因是我的解决方案中的其他项目具有这样的依赖性:

I suppose that is partly due to the other projects in my solution with dependencies like this:

<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.*" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.1.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.*" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.*" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.*" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.1.*" />

2.1.1似乎没有更新的sdk,但是GitHub上Microsoft.AspNetCore.App 2.1.1的可用性似乎对我来说很麻烦.

There does not seem to be an updated sdk for 2.1.1 but the availability of Microsoft.AspNetCore.App 2.1.1 on GitHub seems to be breaking things for me.

推荐答案

您的问题是您的csproj的这一行:

Your problem is this line of your csproj:

<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />

*表示选择该Nuget软件包的最新2.1版本.对于许多软件包,这将是完美的.但是,该软件包的v2.1.1需要安装匹配的v2.1.1 SDK.到目前为止,它不可用(它目前已被阻止).

The * is saying to pick the latest 2.1 version of that Nuget package. For many packages this would be perfectly fine. However, v2.1.1 of that package requires a matching v2.1.1 SDK to also be installed. As of right now it it not available (it's currently blocked).

但是,如果您阅读从ASP.NET Core 2.0到2.1 文档,您将看到以下内容:

However, if you read the Migrate from ASP.NET Core 2.0 to 2.1 docs, you will see this:

用无版本的"Microsoft.AspNetCore.App"包引用替换指定的版本"Microsoft.AspNetCore.All"包引用.

Replace the version specified "Microsoft.AspNetCore.All" package reference with the versionless "Microsoft.AspNetCore.App" package reference.

现在可以通过您要定位的SDK版本来推断该版本.这意味着您的csproj现在应该包含以下内容:

The version is now inferred by the version of the SDK you are targetting. This means your csproj should now contain this:

<PackageReference Include="Microsoft.AspNetCore.App" />

这篇关于Netcore 2.1.1版本导致应用程序无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆