使用xUnit处理netstandard1.6

编程入门 行业动态 更新时间:2024-10-26 16:24:36
本文介绍了使用xUnit处理netstandard1.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找对netstandard1.6库使用测试框架。我尝试遵循并编辑 xUnit入门(.NET Core / ASP.NET Core) 没有成功。按照xUnit的教程,在VS 2015 Update 3 RTM上使用dotnetcore lib和我的project.json文件,以重现错误。

I am looking to use a test framework for a netstandard1.6 library. I tried to follow and edit Getting started with xUnit (.NET Core / ASP.NET Core) without success. Follow the xUnit's tutorial with a dotnetcore lib on VS 2015 Update 3 RTM with my project.json file to reproduce the error.

project.json:

project.json :

{ "version": "1.0.0-*", "testRunner": "xunit", "dependencies": { "NETStandard.Library": "1.6.0", "xunit": "2.2.0-beta2-build3300", "dotnet-test-xunit": "2.2.0-preview2-build1029" }, "frameworks": { "netstandard1.6": { "imports": "dnxcore50" } }, "runtimes": { "win10-arm": {}, "win10-arm-aot": {}, "win10-x86": {}, "win10-x86-aot": {}, "win10-x64": {}, "win10-x64-aot": {} } }

错误:

Severity Code Description Error NU1002 The dependency dotnet-test-xunit 2.2.0-preview2-build1029 does not support framework .NETStandard,Version=v1.0

我可以降级到dotnet-test-xunit 2.2.0-preview2-build1029支持的standard版本吗?

Can I downgrade to a version of standard supported by dotnet-test-xunit 2.2.0-preview2-build1029? Is there any known work around to use xUnit with it?

由于我是一个新的project.json和dotnetcore,我可能会错过一些有用的东西。

As I am a bit new project.json and dotnetcore, I might missed something useful.

推荐答案

这对我有用。似乎现有的xunit版本尚不支持netstandard 1.6库。尝试将项目json更改为 xunit网站中提供的外观。这也假设您创建了一个核心库项目

This worked for me. It seems existing xunit versions do not support the netstandard 1.6 library yet. Try changing your project json to look like this as provided for in xunit site. This also assumes that you created a core library project

{ "version": "1.0.0-*", "testRunner": "xunit", "dependencies": { "xunit": "2.2.0-beta2-build3300", "dotnet-test-xunit": "2.2.0-preview2-build1029" }, "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" } } } } }

更多推荐

使用xUnit处理netstandard1.6

本文发布于:2023-11-06 01:47:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562409.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:xUnit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!