2017-08-21 19 views
11

我试图更新到网络核心2.0,但我发现与参考更新到ASP.NET 2.0的核心 - 包是不是netcoreapp2.0

已安装的所有软件包这些错误兼容问题,也许:

我得到的参考输出

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

之后,我得到这个消息对所有组件:

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

这是手册:

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

SDK更新到2.0

enter image description here

这是我的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> 

在此先感谢您的帮助。

编辑:更多信息

编译解决方案后,我得到这个消息

1> CSC:错误CS1703:具有同等身份的多重组件已经被输入:C:\用户\ 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'。删除重复引用之一。

+0

当您创建一个全新的.net core 2项目然后将EF添加到它时会发生什么? – TrevorBrooks

回答

11

通过更新的Visual Studio解决它的版本15.3.3

此外,确保SDK更新到2.0版

+3

SDK下载链接:https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md – GraehamF

20

另外,可以用的NuGet的过时版本发生此错误。具体来说,4.0.0展示了这个问题。升级到4.3.0为我解决了这个问题。

VSTS代理似乎使用4.0.0,所以为了解决这个问题,有一个nuget版本安装程序任务,您可以作为构建步骤的一部分运行以升级在构建管道中运行的nuget版本。

+0

添加此步骤,为我解决它。 – Maciek

+2

你可以在任务上添加一些细节吗?我在TFS 2017.2中看不到它。 –

+0

@ DanielA.Thompson添加** NuGet工具安装程序**任务并更改**版本的NuGet.exe以在相应版本上安装**。 – kogoia

相关问题