Nunit-console: Updating NUnit.ConsoleRunner.NetCore to -beta2 with NuGet raises NU1202 and NU1212 error

Created on 28 Jan 2021  路  4Comments  路  Source: nunit/nunit-console

I'm trying to update the NUnit.ConsoleRunner.NetCore from -beta1 to -beta2. Unfortunately it raises the following errors:

NU1202: Package NUnit.ConsoleRunner.NetCore 3.12.0-beta2 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package NUnit.ConsoleRunner.NetCore 3.12.0-beta2 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any
NU1212: Invalid project-package combination for NUnit.ConsoleRunner.NetCore 3.12.0-beta2. DotnetToolReference project style can only contain references of the DotnetTool type 
Package 'NUnit.ConsoleRunner.NetCore 3.12.0-beta2' has a package type 'DotnetTool' that is not supported by project '_build'.

_build is our NUKE build project.
This is the _build.csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <OutputType>Exe</OutputType>
    <RootNamespace>Orca.Build</RootNamespace>
    <NoWarn>CS0649;CS0169;NU1701</NoWarn>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <OutputPath></OutputPath>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Atlassian.SDK" Version="12.4.0" />
    <PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2020.3.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
    <PackageReference Include="Nuke.Common" Version="5.0.2" />
    <PackageReference Include="NUnit.ConsoleRunner.NetCore" Version="3.12.0-beta1" />
  </ItemGroup>

  <ItemGroup>
    <NukeSpecificationFiles Include="**\*.json" Exclude="bin\**;obj\**" />
    <NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
    <None Remove="*.csproj.DotSettings;*.ref.*.txt" />

    <!-- Common build related files -->
    <None Include="..\..\build.ps1" />
    <None Include="..\..\.nuke" />
    <None Include="..\..\global.json" Condition="Exists('..\..\global.json')" />
    <None Include="..\..\azure-pipelines.yml" Condition="Exists('..\..\azure-pipelines.yml')" />
    <None Include="..\..\Jenkinsfile" Condition="Exists('..\..\Jenkinsfile')" />
    <None Include="..\..\appveyor.yml" Condition="Exists('..\..\appveyor.yml')" />
    <None Include="..\..\.travis.yml" Condition="Exists('..\..\.travis.yml')" />
    <None Include="..\..\GitVersion.yml" Condition="Exists('..\..\GitVersion.yml')" />
    <None Include="Assets\.nuget\nuget.exe" />
    <None Include="Assets\.nuget\packages.config" />
  </ItemGroup>

</Project>

I'm also using NUnit v3.13.0 and NUnit3TestAdapter v4.0.0-beta1, but don't think, they influence the installation in any way.

I'm not quite sure what this error tells me. From the information I gathered, the NUnit.ConsoleRunner.NetCore is now an executable and not a .dll anymore, so I cannot reference it? That would mean, I need to use dotnet nunit as mentioned in here https://github.com/nunit/nunit-console/pull/810?

confirm question

All 4 comments

Hey @Prodigio, thanks for filing this.

It's interesting - it wasn't a change I was aware that #810 was going to cause, but I'm not sure it's a bad one. In a "normal" workflow, we'd intend that the Console itself is used as a CLI tool, rather than referenced as a dependency. User's looking to run tests through a dll dependency should instead be looking to integrate with the NUnit Engine, rather than the console.

I'm not familiar with NUKE, other than a quick google just now - but I think the question here is instead how NUKE supports using .NET tools. Not my area of expertise I'm afraid - but have you tried calling the NUnit Console in the way of the xunit example on this page?

https://nuke.build/docs/authoring-builds/cli-tools.html#lightweight-integration

Hey @ChrisMaddock, thanks for your reply.

I'll have a look into the lightweight integration from NUKE and our test context and will update this answer.

So @ChrisMaddock, I had a look at this issue again - finally.

I was able to replace NUnit.ConsoleRunner.NetCore with NUnit.Engine. Tests are running fine.

Anyway, I've the following question: how would I reference/use the NuGet package then, if I cannot install the latest update of NUnit.ConsoleRunner.NetCore?

Hi @Prodigio,

Glad you're up and running. NUnit.Engine is the entry point we'd recommend when referencing from code. The NUnit.ConsoleRunner.NetCore package was built to be used as a .NET tool - so using it via dotnet nunit would be the main use-case. Wasn't aware however that this restricted using it in other ways - will probably have to do some testing to see if we want to add a second package or not. Thanks for raising this while it's still in Beta. 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CharliePoole picture CharliePoole  路  8Comments

mitchellmaler picture mitchellmaler  路  3Comments

CharliePoole picture CharliePoole  路  6Comments

MikeTheGreat picture MikeTheGreat  路  5Comments

michaelrobayoGasTag picture michaelrobayoGasTag  路  5Comments