我是 NUnit 的新手,正在尝试在 Visual Studio Community 2017 下开始使用它;我很难起床和跑步。
NUnit 的实际安装进展顺利。我按照 NUnit wiki 上的安装页面上的过程(选项 1)添加 NUnit 和 NUnit.console,现在在解决方案中拥有这些(以及 NUnit.ConsoleRunner 和一些 NUnit.Extension.* 扩展)。
NUnit wiki 的.NET Core 和 .NET Standard 页面说接下来是安装 NUnit 模板,这就是我卡住的地方。它说“运行dotnet new -i NUnit3.DotNetNew.Template以安装 NUnit 模板”。我的系统上似乎没有 dotnet.exe。查看 Windows 上的 dotnet 命令可执行文件在哪里?看起来获得它的方法是 install Microsoft.EntityFrameworkCore.Tools,这导致我访问https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/。基于此,我Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.0.1从包管理器控制台尝试过;但这给了我错误:
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.
所以我真的要在这里陷入困境,从NUnit3.DotNetNew.Templateto 到dotnet.exeto Microsoft.EntityFrameworkCore.Tools 2.0.1。任何想法接下来要尝试什么?