-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility issue between xunit.v3 and MSTest projects #4693
Comments
Using two different frameworks in the same project is not a supported scenario in the new testing platform. Is this something you accidentally found out, or is there a use case where you need to mix xunit tests and mstest tests in the same assembly? |
This was purely accidental. I had a Directory.Build.props file that was adding package references using a condition, and the condition was picking up a project that I didn't expect, so xunit (and then xunit.v3 once I updated to that version) was added to that MSTest project accidentally. What's interesting about this is that having a reference to xunit didn't cause an issue. So it took me quite a bit of time to figure out what was causing a compilation failure in this project, especially since the package reference was being added through a Build.props file and not in the csproj itself. The obscurity of the error made me think maybe there was an opportunity for improvement here, not to support both, but perhaps to produce a more appropriate compilation error. Anyway, this issue is purely an issue from having an unintended package reference...there was no xunit code in the project I was working on. I've corrected that and no longer have an issue, but I wanted to report it here just the same. At least it might result in someone searching for this problem at some point coming across this ticket to better understand what is going on. |
Thanks for reporting, yes the error could definitely be better, especially if we don't plan to support it. |
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
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.
The text was updated successfully, but these errors were encountered: