我正在try 更新到Net Core2.0,但在随参考一起安装的所有包上都出现了这些错误.

The problem, maybe:

我在输出中得到了对netcoreapp1.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)

之后,我收到所有组件的信息:

微软.AspNetCore.ANYPACKAGE 2.0.0软件包与netcoreapp2不兼容.0(.NETCoreApp,版本=v2.0).微软.AspNetCore.WebSockets 2.0.0包支持:netstandard2.0(.NETStandard,Version=v2.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>

提前感谢您的帮助.

Edit: More info

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

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.

推荐答案

updatingVisual Studio的速度解决了它的最新版本(对我来说是15.3.3)

此外,请确保将SDK更新为版本2.0,并将NuGet更新为其最新版本.

Asp.net相关问答推荐

如何处理当前文件中基本文件中的S onClick方法

ASP.NET Core 延迟加载始终返回 null

如何使用 Get-Process powershell 命令通过端口号获取进程的 ID

.Net Framework:w3wp.exe 中的异常

ASP.NET 核心中的 Request.CreateResponse

指定的 CGI 应用程序遇到错误,服务器终止了进程

MSCharts找不到请求类型'GET'的http处理程序错误

使用会话变量有多安全 - asp.net / c#

ASP.NET Response.Redirect 使用 302 而不是 301

解析 JSON 响应的最简单方法

Devexpress 或 Telerik Controls 比较

MVC5 身份验证中的......与主域之间的信任关系失败

ASP.NET web.config:system.web.compilation 中的 debug 属性的默认值是什么?

System.Reflection.Assembly.LoadFile 锁定文件

ContentResult 与字符串

将 C# ASP.NET 数组传递给 Javascript 数组

好的 ASP.NET 类似 excel 的网格控件?

使用 NLog 在 ASP.NET Web API 2.1 中进行全局异常处理?

如何修复 ASP.NET 错误文件 'nnn.aspx' 尚未预编译,无法请求.?

POST 字符串到 ASP.NET Web Api 应用程序 - 返回 null