1

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?

codingatty
  • 2,026
  • 1
  • 23
  • 32
  • You can get the dotnet.exe by installing the .NET Core SDK from: https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.3-windows-x64-installer – nemesv Jan 01 '18 at 19:04
  • @nemesv Thanks! It looks like the NUnit template installed. (I got a weird error message, but it looks like it worked anyway.) If you leave this as an answer I'll accept it. – codingatty Jan 01 '18 at 19:16

2 Answers2

0

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.

nemesv
  • 138,284
  • 16
  • 416
  • 359
  • Thanks! That got me dotnet.exe, which took me a lot further down the road. After trying some more things, I found further that, to get NUnit working, I had use the "Get Tools and Features" menu item to add, under "Other Toolsets" ".NET Core Cross-Platform Development". This gave me the options I needed to create an NUnit test per http://www.alteridem.net/2017/05/04/test-net-core-nunit-vs2017/ , and I think would have also gotten me the .NET Core SDK, including dotnet.exe. I only comment in case anyone else is looking into this. – codingatty Jan 02 '18 at 02:45
0

In case this may be of any help to someone: in Visual Studio Community 2017, you can install "NUnit VS Template" from the main menu as follows:

  1. Go to: Tools > Extensions and Updates > Online
  2. Searh for 'nunit'
  3. Click the nunit package you need, and then 'install' on the lateral panel.
  4. You may need to close and reopen VS 2017

Hope it helps

EuripidesL
  • 123
  • 2
  • 8