.net core 1.1 web app with Identity Framework“无法恢复……不兼容……”

Posted

技术标签:

【中文标题】.net core 1.1 web app with Identity Framework“无法恢复……不兼容……”【英文标题】:.net core 1.1 web app with Identity Framework "cannot restore...is not compatible with..." 【发布时间】:2017-10-20 13:53:08 【问题描述】:

我安装的 VS 2017 是最新的,在使用 Identity(个人用户帐户)创建新的 .NET Core 1.1 Web 应用程序时,我收到大量错误,告诉我软件包不兼容。在我看来,Identity Core 的工具出现了严重问题。没有可用的更新。我尝试在 .csproj 中更改为不同的“netstandard...”和“netcoreapp...”目标,但没有解决。

如果我创建一个没有 Identity 的单独项目,它会按预期恢复和构建。

这是我的测试项目的完整输出:

错误包 System.Text.Encoding.CodePages 4.3.0 与 netcoreapp1.1 (.NETCoreApp,Version=v1.1) 不兼容。包 System.Text.Encoding.CodePages 4.3.0 支持: - monoandroid10 (MonoAndroid,版本=v1.0) - monotouch10 (MonoTouch,版本=v1.0) - netstandard1.3(.NETStandard,版本=v1.3) -xamarinios10(Xamarin.iOS,版本=v1.0) - xamarinmac20(Xamarin.Mac,版本=v2.0) - xamarintvos10(Xamarin.TVOS,版本=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,版本=v1.0) 错误包 System.IO.Pipes 4.3.0 与 netcoreapp1.1 (.NETCoreApp,Version=v1.1) 不兼容。软件包 System.IO.Pipes 4.3.0 支持:netstandard1.3 (.NETStandard,Version=v1.3) 错误包 Microsoft.CodeAnalysis.Workspaces.Common 1.3.0 与 netcoreapp1.1 (.NETCoreApp,Version=v1.1) 不兼容。包 Microsoft.CodeAnalysis.Workspaces.Common 1.3.0 支持: - net45 (.NETFramework,版本=v4.5) - netstandard1.3(.NETStandard,版本=v1.3) - 便携-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7) 错误 一个或多个包与 .NETCoreApp 不兼容,Version=v1.1。 错误包 Microsoft.CodeAnalysis.CSharp.Workspaces 1.3.0 与 netcoreapp1.1 (.NETCoreApp,Version=v1.1) 不兼容。包 Microsoft.CodeAnalysis.CSharp.Workspaces 1.3.0 支持: - net45 (.NETFramework,版本=v4.5) - netstandard1.3(.NETStandard,版本=v1.3) - 便携-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7) 错误包 Microsoft.Composition 1.0.27 与 netcoreapp1.1 (.NETCoreApp,Version=v1.1) 不兼容。包 Microsoft.Composition 1.0.27 支持:portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)

【问题讨论】:

尝试使用 dotnet nuget locals --clear all 清除 Nuget 缓存 @TravisBoatman 不,运行后没有任何变化。 就像@TravisBoatman 说的对我有用,清除 NuGet 缓存并在之后运行 Web 应用程序 @SamekaTV 您是否在您的 Web 项目的上下文中运行它?如果您在全球范围内运行它,我不确定它是否有效。 @TravisBoatman 我确实从应用程序根文件夹运行它。它显然按预期运行,因为之后代码中的所有 refs 都被破坏了。恢复包并尝试重建解决方案会导致相同的错误。 【参考方案1】:

清除 NuGet 缓存什么也没做。删除并重新创建项目使问题消失了。

【讨论】:

以上是关于.net core 1.1 web app with Identity Framework“无法恢复……不兼容……”的主要内容,如果未能解决你的问题,请参考以下文章

Asp.Net Core 1.1 消费web api

.Net Core集成Office Web Apps

在 Asp.Net Core App 中访问 Web.config 设置?

Building a Web App with ASP.NET Core, MVC, Entity Framework Core, Bootstrap, and Angular

Blazor Web Assembly App .Net Core Hosted:发布运行时错误

.net core app.UseHsts()