让 NUnit 在 Visual Studio Community 2017 下工作
Getting NUnit working under Visual Studio Community 2017
我是 NUnit 的新手,正尝试在 Visual Studio Community 2017 下开始使用它;我很难起床 运行。
NUnit 的实际安装很顺利。我按照 NUnit wiki 上 Installation page 中的程序(选项 1)添加了 NUnit 和 NUnit.console,现在有了这些(以及 NUnit.ConsoleRunner 和少数 NUnit.Extension。 * 扩展)在解决方案中。
NUnit wiki 的 .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/。基于此,我从包管理器控制台尝试了 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
您需要select选项:.NET Core SDK
.NET Core SDK
Cross-platform .NET implementation. The smallest download to build .NET apps, using command line tools and any editor.
如果这可能对某人有帮助:在 Visual Studio Community 2017 中,您可以从主菜单安装 "NUnit VS Template",如下所示:
- 转到:工具 > 扩展和更新 > 在线
- 搜索 'nunit'
- 点击您需要的nunit包,然后在侧面板中'install'。
- 您可能需要关闭并重新打开 VS 2017
希望对您有所帮助
我是 NUnit 的新手,正尝试在 Visual Studio Community 2017 下开始使用它;我很难起床 运行。
NUnit 的实际安装很顺利。我按照 NUnit wiki 上 Installation page 中的程序(选项 1)添加了 NUnit 和 NUnit.console,现在有了这些(以及 NUnit.ConsoleRunner 和少数 NUnit.Extension。 * 扩展)在解决方案中。
NUnit wiki 的 .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/。基于此,我从包管理器控制台尝试了 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
您需要select选项:.NET Core SDK
.NET Core SDK
Cross-platform .NET implementation. The smallest download to build .NET apps, using command line tools and any editor.
如果这可能对某人有帮助:在 Visual Studio Community 2017 中,您可以从主菜单安装 "NUnit VS Template",如下所示:
- 转到:工具 > 扩展和更新 > 在线
- 搜索 'nunit'
- 点击您需要的nunit包,然后在侧面板中'install'。
- 您可能需要关闭并重新打开 VS 2017
希望对您有所帮助