c# - 让 NUnit 在 Visual Studio Community 2017 下工作

标签 c# visual-studio visual-studio-2017 nunit visual-studio-community

我是 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.Templatedotnet.exeMicrosoft.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/

相关文章:

c# - 使用dia-sdk从microsoft pdb文件加载数据

c# - 对目录中的文件名进行排序,给出错误排序的结果

C# WPF 组合框可编辑只允许列表中的选项

ios - 从 VS 调试 iOS 时,程序 'Mono' 已退出,代码为 0 (0x0)

c# - 项目设置中缺少 Visual Studio 2017 包选项卡

c# - 用 C# 编写的 COM 对象 - 获取类,但不获取方法

c# - 带条件的 xml 序列化

c# - 在自定义构建任务中运行 Project.Build() 时如何获取构建输出、错误列表?

c++ - boost::optional 与 std::optional 对于不可复制的对象

azure - 通过 Visual Studio 2017 发布 Azure 函数项目后,所有函数应用程序都转为只读模式