Lui*_*Flo 26 .net asp.net asp.net-core
我正在尝试更新到.NET Core 2.0,但是我在使用该引用安装的所有软件包上都收到了这些错误
问题可能是:
我在输出中得到了netcoreapp1.0的引用
Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0软件包与netcoreapp1.0(.NETCoreApp,Version = v1.0)不兼容.Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0软件包支持:netcoreapp2.0(.NETCoreApp,Version = v2.0)一个或多个软件包与.NETCoreApp,Version = 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.1.1)应用程序(> = 1.0.0) - > Microsoft.ApplicationInsights.AspNetCore(> = 2.0.0)
之后,我收到所有组件的消息:
Microsoft.AspNetCore.ANYPACKAGE 2.0.0软件包与netcoreapp2.0(.NETCoreApp,Version = v2.0)不兼容.Microsoft.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
这是我的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:\ 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'.删除其中一个重复的引用.
小智 36
此外,使用过时的nuget版本可能会发生此错误.具体来说,4.0.0表明了这个问题.升级到4.3.0为我解决了问题.
VSTS代理似乎使用4.0.0,因此要解决此问题,有一个nuget版本安装程序任务,您可以在构建步骤中运行该任务,以升级在构建管道中运行的nuget版本.
Lui*_*Flo 19
通过将 Visual Studio 更新到它的最新版本来解决它(对我而言是15.3.3)
此外,请确保SDK已更新至2.0版,NuGet已更新至其最新版本.