简体   繁体   English

如何在 Visual Studio 2019 中创建 .NET framework 4.6 版本的 XUnit 项目?

[英]How do I create .NET framework 4.6 version of XUnit project in Visual Studio 2019?

I notice when I start up Visual Studio 2019, I am unable to create a .NET Framework version of XUnit or NUnit (only MSTests).我注意到当我启动 Visual Studio 2019 时,我无法创建 XUnit 或 NUnit(仅限 MSTest)的 .NET Framework 版本。 We have been mandated to use XUnit tests, but our solution is all .NET Framework.我们被要求使用 XUnit 测试,但我们的解决方案全是 .NET Framework。 Some of the nuget packages are dependent on being .NET Framework (for Sitecore 8.2) and thus I can't add them to a .NET Core project.一些 nuget 包依赖于 .NET Framework(对于 Sitecore 8.2),因此我无法将它们添加到 .NET Core 项目中。 I cannot upgrade any of the legacy project to .NET Core or to Sitecore 9+ at this time.我目前无法将任何旧项目升级到 .NET Core 或 Sitecore 9+。

How do I add in a .NET Framework XUnit project?如何添加 .NET Framework XUnit 项目? Is there something wrong with my Visual Studio setup?我的 Visual Studio 设置有问题吗? Is it not supported?不支持吗? I have been unable to find documentation from Microsoft about this.我一直无法从 Microsoft 找到有关此的文档。 Thanks.谢谢。

  • First use the xUnit Test Project (.NET Core) project template.首先使用xUnit Test Project (.NET Core)项目模板。

  • Then go edit the .csproj file and change <TargetFramework>netcoreapp2.2</TargetFramework> to <TargetFramework>net462</TargetFramework> .然后编辑 .csproj 文件并将<TargetFramework>netcoreapp2.2</TargetFramework>更改为<TargetFramework>net462</TargetFramework>

  • That's it.就是这样。 :) :)

  • Install the xUnit Test Project Template for .net framework from here .此处安装xUnit Test Project Template for .net frameworkxUnit Test Project Template for .net framework
  • Create a new xUnit Test Project (.NET Framework) project创建一个新的xUnit Test Project (.NET Framework)项目在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Visual Studio 2019 中创建 SwCsharpAddin 项目? - How do I create the SwCsharpAddin project in Visual Studio 2019? 如何将 Visual Studio 2019 中的 .NET 版本更改为 .NET Framework 4.7.2? - How to change .NET version in Visual Studio 2019 to .NET Framework 4.7.2? 如何在Visual Studio 2017中调试.NET 4.6框架源代码? - How do I debug .NET 4.6 framework source code in Visual Studio 2017? 如何将 .Net 框架添加到 Visual Studio preview 2019 项目 - How to add .Net framework to Visual Studio preview 2019 project 如何在 Visual Studio 2005 或 2019 中为 .NET Framework 2.0 编译一个简单的 WinForms C# 应用程序? - How do I compile a simple WinForms C# application for .NET Framework 2.0 in Visual Studio 2005 or 2019? 为 .NET Core 类库项目选择框架版本 - Visual Studio 2019 - Select framework version for .NET Core Class Library project - Visual Studio 2019 如何在 Visual Studio 2019 中更改 C# 版本 - How do I change the C# version in Visual Studio 2019 在 Visual Studio 2019 / .NET Framework 4.8 中确定 C# 版本 - Determine C# version in Visual Studio 2019 / .NET Framework 4.8 如何在使用 Visual Studio 时为 .net 框架 4.7.2 项目创建 SDK 样式项目? - How do I reate an SDK style project for a .net framework 4.7.2 project in using visual studio? 如何在 Visual Studio 2019 中创建与 Visual Studio 2015 兼容的扩展? - How do I create a Visual Studio 2015 compatible extension in Visual Studio 2019?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM