Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# dotnet测试能否指定运行时标识符?_C#_.net Core - Fatal编程技术网

C# dotnet测试能否指定运行时标识符?

C# dotnet测试能否指定运行时标识符?,c#,.net-core,C#,.net Core,我正在尝试使用,但我希望能够指定一个。具体来说,我需要在32位模式下运行单元测试(RIDwin-x86)。我可以使用dotnet运行,dotnet发布等设置RID。但是dotnet测试似乎不支持这一点。有解决办法吗?根据文档,您应该能够做到这一点 >dotnet测试-帮助 用法:dotnet测试[选项][-]…] ... 选项: --运行时要测试的目标运行时。 ... 因此,在您的情况下,应该是: >dotnet测试——运行时win-x86 希望这有帮助 哦。有趣的是,在线文档中没有提到这一点

我正在尝试使用,但我希望能够指定一个。具体来说,我需要在32位模式下运行单元测试(RID
win-x86
)。我可以使用
dotnet运行
dotnet发布
等设置RID。但是
dotnet测试
似乎不支持这一点。有解决办法吗?

根据文档,您应该能够做到这一点

>dotnet测试-帮助

用法:dotnet测试[选项][-]…]
...
选项:
--运行时要测试的目标运行时。
...
因此,在您的情况下,应该是:

>dotnet测试——运行时win-x86


希望这有帮助

哦。有趣的是,在线文档中没有提到这一点。这很有帮助,但现在我得到了
BadImageFormatException
。它声称无法加载或发现任何测试。我想您必须将要测试的目标框架添加到.csproj文件中。您救了我的命。官方文件没有!
Usage: dotnet test [options] <PROJECT | SOLUTION> [[--] <RunSettings arguments>...]]

...
Options:
  --runtime <RUNTIME_IDENTIFIER>           The target runtime to test for.
...