question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
karanjitsinghcommented, Jul 16, 2019

@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.

1reaction
mfogliattocommented, Dec 29, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found