I am trying to create my own NUnit console runner.
Adding a reference to NUnit
to my project does not let me access NUnit.Common
, NUnit.Engine
or NUnit.Options
as used in the console runner in
https://github.com/nunit/nunit-console/blob/master/src/NUnitConsole/nunit3-console/Program.cs
My Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.11.0" />
</ItemGroup>
</Project>
My source:
using System;
using NUnit.Common;
using NUnit.Options;
using NUnit.Engine;
namespace MyNUnitRunner
{
class Program
{
static ConsoleOptions Options = new ConsoleOptions(new DefaultOptionsProvider(), new FileSystem());
private static ExtendedTextWriter _outWriter;
static void Main(string[] args)
{
try
{
Options.Parse(Options.PreParse(args));
}
catch (OptionException ex)
{
WriteHeader();
OutWriter.WriteLine(ColorStyle.Error, string.Format(ex.Message, ex.OptionName));
return ConsoleRunner.INVALID_ARG;
}
}
}
}
Output of dotnet build
:
Program.cs(2,13): error CS0234: The type or namespace name 'Common' does not exist in the namespace 'NUnit' (are you missing an assembly reference?) [/Users/jon/DEV/CSSandbox/MyNUnitRunner/MyNUnitRunner.csproj]
Program.cs(3,13): error CS0234: The type or namespace name 'Options' does not exist in the namespace 'NUnit' (are you missing an assembly reference?) [/Users/jon/DEV/CSSandbox/MyNUnitRunner/MyNUnitRunner.csproj]
Program.cs(4,13): error CS0234: The type or namespace name 'Engine' does not exist in the namespace 'NUnit' (are you missing an assembly reference?) [/Users/jon/DEV/CSSandbox/MyNUnitRunner/MyNUnitRunner.csproj]
Program.cs(11,16): error CS0246: The type or namespace name 'ConsoleOptions' could not be found (are you missing a using directive or an assembly reference?) [/Users/jon/DEV/CSSandbox/MyNUnitRunner/MyNUnitRunner.csproj]
Program.cs(12,24): error CS0246: The type or namespace name 'ExtendedTextWriter' could not be found (are you missing a using directive or an assembly reference?) [/Users/jon/DEV/CSSandbox/MyNUnitRunner/MyNUnitRunner.csproj]
0 Warning(s)
5 Error(s)
Which packages do I need to refer to and how can I find this out (New to C#)?