testfx: MSTest.TestAdapter does not get nuget-restored if the target framework is .NETStandard2.0
Description
MSTest.TestAdapter does not get nuget-restored if the target framework is .NETStandard2.0
Steps to reproduce
- Install Visual Studio 15.5.0 Preview 2
- Create a new project using
File | New Project | Visual C# | .NET Standard | Class Library (.NET Standard)
- Add a NuGet Reference to the project to
MSTest.TestFramework (v1.2.0)
- Add a NuGet Reference to the project to
MSTest.TestAdapter (v1.2.0)
- Build the project
Expected behavior
No warning. The MSTest packages should get NuGet-restored as expected.
Actual behavior
warning NU1701: Package ‘MSTest.TestAdapter 1.2.0’ was restored using ‘.NETFramework,Version=v4.6.1’ instead of the project target framework ‘.NETStandard,Version=v2.0’. This package may not be fully compatible with your project.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 32 (16 by maintainers)
If I have a library that I want to make sure runs on any NET Standard, why shouldn’t it be possible? Isn’t the point of having a reference in VisualStudio stating “NETStandardLibrary 2.0” means all applicable references of that library set? And if so, how testing on NET Core 2.2 proves that the library can run on any NET Standard? There is quite a chance that it may end up requiring NET Framework 4.7.2 with this kind flaky testing.
Any updated on this, please? I drags on, and on, and on.
This makes no sense to me. That restriction applies to executables, but not class libraries. Sure in the end you’d want to execute your unit tests on a specific runtime, but there’s no reason why we can’t have unit tests (and the adapter) be .NET Standard.
@pvlakshm Could we reopen this issue? I have a use-case for using the TestAdapter as .NET Standard, when executing tests on Xamarin. I’ve created my own port of MSTest.TestAdapter (https://www.nuget.org/packages/MSTestX.TestAdapter/) for this purpose, but would prefer just referencing the official package rather than forking and having to attempt to keep in-sync (it compiles as is, so very little effort on your part).
We added NETStandard2.0 support into the Test Platform. The next step is to add it to TestFX in upcoming previews of Visual Studio 16.9.
I’m blocked by this one as well in the context of WebAssembly tests.
netstandard2.0
is the only possible target at the time for this kind of environment.As part of CPS change, we are trying to consolidate the adapter and framework nuget packages. We will try if this too can be fixed as part of that.
I am blocked too. MSTest.testAdapter is not supported for .Net Standard 2.0 and I have a class lib project which needs to run these tests.