2

NUnit3TestAdapter nuget package shows warning message in reference when target framework is netstandard2.0 but when project target framework is netstandar1.6 it does not show the warning. I would like to understand the difference in this case.

Warning Message is :

Package 'NUnit3TestAdapter 3.12.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

I have c# nunit test project where I need to include NUnit3TestAdapter nuget package. I tried to supress the warning but it's not a solution I feel.

my_project.csproj file content

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

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
    <PackageReference Include="NUnit" Version="3.11.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.12.0" />
  </ItemGroup>

</Project>

I expect NUnit3TestAdapter should not show me the warning when netstandard2.0 if it's not showing for netstandard1.6 target framework.

  • Hey @ManishaHage - can you add the warning you're seeing to your question? – Chris Mar 30 '19 at 15:38
  • @Chris question is updated with warning message. – Sushil Tade Mar 31 '19 at 17:46
  • https://www.fuget.org/packages/NUnit3TestAdapter/3.12.0 Because NuGet expands netcoreapp1.0 for your netstandard1.6 case, but cannot use it for netstandard2.0 https://learn.microsoft.com/en-us/dotnet/standard/net-standard At last it expands net35 and warns you there might be incompatibilities, which can happen if your .NET Framework installation is older than net461. Overall, it is a bad idea to use netstandardxx in a unit test project. You should use the actual target platforms, like netcoreappxx or netxx. – Lex Li Mar 31 '19 at 18:16
  • @LexLi I understood the meaning of NuGet expands netcoreapp1.0 for your netstandard 1.6 case, but can not use it for netstandard2.0. I saw the word implements in docs.midcrosoft are they talking about interfaces? – Sushil Tade Mar 31 '19 at 18:56

0 Answers0