What is Microsoft.NET.Test.Sdk and when should we use it in a test project?
See original GitHub issue👋 This is a general question for the VSTest team.
- What is the
Microsoft.NET.Test.Sdk
nuget package / library? - When should we install this into a project and use it?
Currently, I have a simple test project and just updated this package to version 16.2.0
. Everything is working fine. I then commented it out, full clean and rebuild and ran all the tests … which … worked?
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<!--<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />-->
... cut ....
I’m using Visual Studio 16.1.6 and the project leverages xUnit as the test framework.
I also tried looking through the docs in this repo but couldn’t find anything. The docs were pretty low level / technical … so I might have skipped over something in an attempt to find some info.
Thanks in advance for any help! 🎉
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Unit testing C# with MSTest and .NET
Learn unit test concepts in C# and .NET through an interactive experience building a sample solution step-by-step using dotnet test and ...
Read more >dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >NET project SDK overview
Each project SDK is a set of MSBuild targets and associated tasks that are responsible for compiling, packing, and publishing code.
Read more >Unit testing C# code in .NET Core using dotnet test and xUnit
Learn unit test concepts in C# and .NET Core through an interactive experience building a sample solution step-by-step using dotnet test and ...
Read more >Integration tests in ASP.NET Core
Unit tests are used to test isolated software components, such as individual class methods. Integration tests confirm that two or more app ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@PureKrome, building the project without the reference should work, but running tests will not work. Interestingly, you said running tests also worked? Try running tests both via VS and via the command
dotnet test
.This reference is required for projects targeting dotnet core, it basically carries the test platform reference along with it.
Sorry I didn’t see this earlier. We use the MSTest test adapter. I understand that
Microsoft.NET.Test.Sdk
is required, though test discovery doesn’t seem to work if that one is a dependency of a dependency.The dependency chain looks like follows (all are
PackageReferences
):MyTestProject -> TestDependency -> Microsoft.NET.Test.Sdk