.NET Standard 1.5 XUnit 控制台 运行ner - 如何 运行 我的单元测试?
.NET Standard 1.5 XUnit console runner - How to run my unit tests?
我有一个配置了 .NET Standard 1.5 的测试项目
IDE:Visual Studio 2017 社区
我已经包括 xunit
和 xunit.runner.console
但我不能 运行 测试。
我在测试项目上尝试 dotnet test
,但出现以下错误
Could not find testhost.dll for source 'D:\Dev\Visual Studio
2017\CSharpSeven.NewFeatures\CSharpSeven.NewFeatures\CSharpSeven.Tests\bin\Debug\netstandard1.5\CSharpSeven.Tests.dll'.
Make sure test project has a nuget reference of package
"microsoft.testplatform.testhost".
我的.csproj
如下:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="15.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.console" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSharpSeven\CSharpSeven.csproj" />
</ItemGroup>
</Project>
我一直在努力进行测试 运行ning,有人可以帮忙吗?
您是否尝试过先进行还原和构建?
dotnet restore
dotnet build
这应该添加任何缺失的包,然后您可以 运行 测试。
测试项目需要是可运行的应用程序。您需要针对特定的运行时。例如:
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
查看此答案了解更多信息
我有一个配置了 .NET Standard 1.5 的测试项目
IDE:Visual Studio 2017 社区
我已经包括 xunit
和 xunit.runner.console
但我不能 运行 测试。
我在测试项目上尝试 dotnet test
,但出现以下错误
Could not find testhost.dll for source 'D:\Dev\Visual Studio 2017\CSharpSeven.NewFeatures\CSharpSeven.NewFeatures\CSharpSeven.Tests\bin\Debug\netstandard1.5\CSharpSeven.Tests.dll'. Make sure test project has a nuget reference of package "microsoft.testplatform.testhost".
我的.csproj
如下:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="15.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.console" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSharpSeven\CSharpSeven.csproj" />
</ItemGroup>
</Project>
我一直在努力进行测试 运行ning,有人可以帮忙吗?
您是否尝试过先进行还原和构建?
dotnet restore
dotnet build
这应该添加任何缺失的包,然后您可以 运行 测试。
测试项目需要是可运行的应用程序。您需要针对特定的运行时。例如:
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
查看此答案了解更多信息