我是 NUnit 的新手,正尝试在 Visual Studio Community 2017 下开始使用它;我很难启动和运行。
NUnit 的实际安装进行得很顺利。我遵循了 Installation page 中的程序(选项 1)在 NUnit wiki 上添加 NUnit 和 NUnit.console,现在解决方案中有了这些(以及 NUnit.ConsoleRunner 和一些 NUnit.Extension.* 扩展)。
NUnit wiki 的 .NET Core and .NET Standard page说下一步是安装 NUnit 模板,这就是我卡住的地方。它说“运行 dotnet new -i NUnit3.DotNetNew.Template
以安装 NUnit 模板。”我的系统上似乎没有任何 dotnet.exe。看着Where is the dotnet command executable located on Windows?看起来获得它的方法是安装 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.Template
到 dotnet.exe
到 Microsoft.EntityFrameworkCore.Tools 2.0.1
。有什么想法接下来要尝试什么吗?
最佳答案
你找错地方了。
要获取 dotnet.exe
(不是由 VS2017 开箱即用地安装),您需要从 https://www.microsoft.com/net/download/windows 下载并安装 .NET Core SDK
您需要选择选项:.NET Core SDK
.NET Core SDK
Cross-platform .NET implementation. The smallest download to build .NET apps, using command line tools and any editor.
关于c# - 让 NUnit 在 Visual Studio Community 2017 下工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48052285/