简体   繁体   中英

.Net Core 2.0 Warning NU1603 during dotnet restore, problems with NuGet packages

(world!)

I am writing application APS .Net Core 2.0. In Test project after adding some NuGet packages to .csproj I meet some troubles. At the command dotnet restore an error pops up:

D:\\01_Toci\\100_GIT\\Passenger\\Passenger.Tests\\Passenger.Tests.csproj : warning NU1603: Castle.Core 4.0.0 depends on System.ComponentModel.TypeConverter (>= 4.0.1) but System.ComponentModel.TypeConverter 4.0.1 was not found. An approximate best match of System.ComponentModel.TypeConverter 4.1.0 was resolved.

There is my .csproj code:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <AssemblyName>Passenger.Tests</AssemblyName>
    <PackageId>Passenger.Tests</PackageId>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
    <RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="../Passenger.Core/Passenger.Core.csproj" />
    <ProjectReference Include="../Passenger.Infrastructure/Passenger.Infrastructure.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
    <PackageReference Include="xunit" Version="2.2.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
    <PackageReference Include="FluentAssertions" Version="4.19.0" />
    <PackageReference Include="Moq" Version="4.7.8" />
    <PackageReference Include="dotnet-test-nunit" Version="3.4.0-beta-3" />
  </ItemGroup>

</Project>

and project.assert.json (it's too long, so i decide to use pastebin)

I tried to change versions in the json file,

"System.ComponentModel.TypeConverter": "4.1.0",

and many other options, but nothing has been done...I was stuck. I got mixed up with these nuggets and I do not know how to get out of it.

Please help me.

This worked out for me, just add System.ComponentModel.TypeConverter as the newest version. Managed to reproduce the same error without the packed added. Remember to use the netcoreapp2.0 framework if you say you are using 2.0 instead of 1.1 as you were using for your test project.

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

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

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-*" />
    <PackageReference Include="xunit" Version="2.2.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
    <PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.*" />
    <PackageReference Include="FluentAssertions" Version="4.19.0" />
    <PackageReference Include="Moq" Version="4.7.8" />
    <PackageReference Include="dotnet-test-nunit" Version="3.4.0-*" />
  </ItemGroup>

</Project>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM