更新到ASP.NET Core 2.0-程序包与netcoreapp2.0不兼容 [英] Updating to ASP.NET Core 2.0 - Packages are not compatible with netcoreapp2.0

查看:192
本文介绍了更新到ASP.NET Core 2.0-程序包与netcoreapp2.0不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新到NET Core 2.0,但在与参考一起安装的所有软件包上都遇到了这些错误.

I'm trying to update to NET Core 2.0 but I'm getting these errors on all the packages installed with the reference.

问题可能是:

我在输出中引用了netcoreapp1.0:

Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0软件包与 netcoreapp1.0(.NETCoreApp,版本= v1.0)不兼容. Microsoft.EntityFrameworkCore.Tools.DotNet 2.0. 0个软件包支持:netcoreapp2.0(.NETCoreApp,版本= v2.0) 一个或多个软件包与.NETCoreApp版本= v1.0不兼容. 检测到检测到的程序包:从2.1.1到2.0.0的Microsoft.ApplicationInsights.AspNetCore Microsoft.AspNetCore.All(> = 2.0.0)-> Microsoft.AspNetCore.ApplicationInsights.HostingStartup(> = 2.0.0)-> Microsoft.ApplicationInsights.AspNetCore(> = 2.1.1) 应用程序(> = 1.0.0)-> Microsoft.ApplicationInsights.AspNetCore(> = 2.0.0)

The Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0 package is not compatible with netcoreapp1.0 (.NETCoreApp, Version = v1.0). The Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0 package supports: netcoreapp2.0 (.NETCoreApp, Version = v2.0) One or more packages are not compatible with .NETCoreApp, Version = v1.0. Detection of detected package: Microsoft.ApplicationInsights.AspNetCore from 2.1.1 to 2.0.0   Microsoft.AspNetCore.All (> = 2.0.0) -> Microsoft.AspNetCore.ApplicationInsights.HostingStartup (> = 2.0.0) -> Microsoft.ApplicationInsights.AspNetCore (> = 2.1. 1)   Application (> = 1.0.0) -> Microsoft.ApplicationInsights.AspNetCore (> = 2.0.0)

此后,我收到所有组件的以下消息:

After that, I get this message for all the components:

Microsoft.AspNetCore.ANYPACKAGE 2.0.0软件包与netcoreapp2.0(.NETCoreApp,版本= v2.0)不兼容. Microsoft.AspNetCore.WebSockets 2.0.0程序包支持:netstandard2.0(.NETStandard,版本= v2.0)

The Microsoft.AspNetCore.ANYPACKAGE 2.0.0 package is not compatible with netcoreapp2.0 (.NETCoreApp, Version = v2.0). The Microsoft.AspNetCore.WebSockets 2.0.0 package supports: netstandard2.0 (.NETStandard, Version = v2.0)

这是手册:

https://docs.microsoft. com/en-us/aspnet/core/migration/1x-to-2x/

SDK已更新为2.0:

SDK Updated to 2.0:

这是我的csproj:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="wwwroot\lib\kendo-ui-core\**" />
    <Content Remove="wwwroot\lib\kendo-ui-core\**" />
    <EmbeddedResource Remove="wwwroot\lib\kendo-ui-core\**" />
    <None Remove="wwwroot\lib\kendo-ui-core\**" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="wwwroot\css\bootstrap-lumen.css" />
    <Content Include="wwwroot\css\bootstrap-sand.css" />
    <Content Include="wwwroot\css\bootstrap-sand.min.css" />
    <Content Include="wwwroot\js\application-role-index.js" />
    <Content Include="wwwroot\js\family-index.js" />
    <Content Include="wwwroot\js\jquery-3.2.1.min.js" />
    <Content Include="wwwroot\js\modal-action-store.js" />
    <Content Include="wwwroot\js\populate-district.js" />
    <Content Include="wwwroot\js\store-index.js" />
    <Content Include="wwwroot\js\type-index.js" />
    <Content Include="wwwroot\js\user-index.js" />
    <Content Include="wwwroot\js\jquery.filtertable.min.js" />
    <Content Include="wwwroot\js\machine-index.js" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Bootstrap.v3.Datetimepicker" Version="4.17.45" />
    <PackageReference Include="Bootstrap.v3.Datetimepicker.CSS" Version="4.17.45" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="2.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="NuGet.CommandLine" Version="4.1.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
  </ItemGroup>

</Project>

在此先感谢您的帮助.

修改:更多信息

编译解决方案后,我收到以下消息:

After compiling the solution I got this message:

1> CSC:错误CS1703:已导入具有相同标识的多个程序集:'C:\ Users \ user \ .nuget \ packages \ microsoft.netcore.app \ 2.0.0 \ ref \ netcoreapp2.0 \ System. ComponentModel.dll'和'C:\ Users \ User \ .nuget \ packages \ system.componentmodel \ 4.3.0 \ ref \ netstandard1.0 \ System.ComponentModel.dll'.删除重复的引用之一.

1> CSC: error CS1703: Multiple assemblies with equivalent identity have been imported: 'C: \ Users \ user \ .nuget \ packages \ microsoft.netcore.app \ 2.0.0 \ ref \ netcoreapp2.0 \ System.ComponentModel.dll 'And' C: \ Users \ User \ .nuget \ packages \ system.componentmodel \ 4.3.0 \ ref \ netstandard1.0 \ System.ComponentModel.dll '. Remove one of the duplicate references.

推荐答案

通过 更新 Visual Studio 解决了它的最新版本(我是15.3.3)

Solved it by updating Visual Studio to it's latest version (for me it was 15.3.3)

还要确保将 SDK 更新到版本2.0,并将 NuGet 更新到最新版本.

Also, make sure SDK is updated to version 2.0 and NuGet to its latest version.

这篇关于更新到ASP.NET Core 2.0-程序包与netcoreapp2.0不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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