Updating to ASP.NET Core 2.0 - Packages are not compatible with netcoreapp2.0
我正在尝试更新到net core 2.0,但在安装了引用的所有包上都会出现这些错误。
问题可能是:
我正在获取输出中对netcoreapp1.0的引用
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
这是我的CSPROJ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <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> |
事先谢谢你的帮助。
编辑:更多信息
在编译解决方案之后,我收到了这个消息
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.
此外,此错误也可能发生在过时的nuget版本上。具体来说,4.0.0展示了这个问题。升级到4.3.0解决了这个问题。
VSTS代理似乎使用4.0.0,因此要解决此问题,有一个nuget版本安装程序任务,可以作为生成步骤的一部分运行,以升级在生成管道中运行的nuget版本。
通过将Visual Studio更新为最新版本(对我来说是15.3.3)解决了这个问题。
此外,请确保将sdk更新到2.0版,并将nuget更新到其最新版本。