Skip to content

Compatibility issue between xunit.v3 and MSTest projects #4693

Open
@KirkMunroSagent

Description

Describe the bug

If you have a csproj file containing MSTest unit tests, and you include the new xunit.v3 package (the xunit team changed their package name when they came out with v3), an AutoRegisteredExtensions.cs file is generated that will not compile, with the compiler complaining that TestingPlatformBuilderHook does not exist in Microsoft.VisualStudio.TestTools.UnitTesting.

Steps To Reproduce

Note: This is how I think it should be reproducible based on my understanding of the issue; however, I haven't tested these steps. I simply did a package reference inspection when I realized that it was probably my package management changes that caused the issue locally, undid those changes, and then added the packages back one-by-one until the issue repro'ed.

  1. Create an MSTest project with a simple test.
  2. Add a package reference in your project to xunit.v3.
  3. Build your project.

Expected behavior

The project should build.

Actual behavior

The project fails with the error specified above.

Additional context

This does not happen using the xunit package. The xUnit team has two package naming schemes: xunit* for versions 1 and 2, and xunit.v3* for version 3. I updated to xunit v3 today and ran into this issue, when I learned that I had a package reference to xunit.v3 that was unnecessary (my project where this fails uses MSTest tests exclusively.

Metadata

Assignees

No one assigned

    Labels

    Area: Testing PlatformBelongs to the Microsoft.Testing.Platform core library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions