Search code examples
c#visual-studiovisual-studio-2017nunitvisual-studio-community

Getting NUnit working under Visual Studio Community 2017


I'm new to NUnit and am trying to start using it under Visual Studio Community 2017; I'm having a very difficult time getting up and running.

The actual install of NUnit went well. I followed the procedure (option 1) at the Installation page on the NUnit wiki to add NUnit and NUnit.console, and now have those (and NUnit.ConsoleRunner and a handful of NUnit.Extension.* extensions) in the solution.

The NUnit wiki's .NET Core and .NET Standard page says that next is to install the NUnit template, and here's where I get stuck. It says "Run dotnet new -i NUnit3.DotNetNew.Template to install the NUnit templates." I don't seem to have a dotnet.exe anywhere on my system. Looking at Where is the dotnet command executable located on Windows? it looks like the way to get that is to install Microsoft.EntityFrameworkCore.Tools, which led me to https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/ . Based on that I tried Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.0.1 from the Package Manager Console; but that gives me the errors:

PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.0.1

Install-Package : Could not install package
'Microsoft.EntityFrameworkCore.Tools 2.0.1'. You are trying to install this
package into a project that targets '.NETFramework,Version=v4.5', but the
package does not contain any assembly references or content files that are
compatible with that framework. For more information, contact the package
author.

So I'm really going down a rabbit-hole here, from NUnit3.DotNetNew.Template to to dotnet.exe to Microsoft.EntityFrameworkCore.Tools 2.0.1. Any ideas what to try next?


Solution

  • You were looking in the wrong place.

    To get the dotnet.exe (which is not installed by VS2017 out of the box) you need to donwload and install the .NET Core SDK from https://www.microsoft.com/net/download/windows

    You need to select the option: .NET Core SDK

    .NET Core SDK
    Cross-platform .NET implementation. The smallest download to build .NET apps, using command line tools and any editor.