Have you created a class library for tests with XUnit and .NET standard? Doesn’t it work?
I had the same problem and the stackoverflow questions about it didn’t help.
What I did was to create a new temp project from the Visual Studio 2017 command line by running
dotnet new xunit. That created a new project file with the correct settings.
As it turns out, you can’t use a .NET Standard class library for xunit. You need to create a .NET core one. All your other libraries can still using .NET Standard.
I edited my own MyProject.Test.csproj. Here’s what it looks like after my edits:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <IsPackable>false</IsPackable> </PropertyGroup> <ItemGroup> <PackageReference Include="FluentAssertions" Version="4.19.2" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170427-09" /> <PackageReference Include="xunit" Version="2.2.0" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\SharpMessaging\SharpMessaging.csproj" /> </ItemGroup> </Project>
Hope that it helps you too.