mstest

Use MSTest.Sdk for TestHelper


I just ported all our test projects to MSTest.Sdk

But now I wonder how to deal with the TestHelperProject (This is a project providing Assert-Helpers, Config-Helper etc for the tests) so it is not a test itself but need the Test Nuget Packages.

I could just use a MSTest.Sdk csproj file but then it creates a exe and I'm not sure if there are other downsides

I found https://github.com/microsoft/testfx/blob/main/samples/FxExtensibility/FxExtensibility.csproj on MSTest github and wondered why this example test helper uses Microsoft.NET.Sdk


Solution

  • For this kind of projects, you need to set IsTestApplication property to false in your project, just under any PropertyGroup add <IsTestApplication>false</IsTestApplication> .

    It seems this part was missing in the documentation page for MSTest.Sdk, so I'm also updating the documentation in https://github.com/dotnet/docs/pull/48016