Announcing MSTest V2 Framework support for .NET Core 1.0 RTM

Pratap Lakshman

MSTest V2 is now supported on .NET Core 1.0 RTM. API changes in .NET Core 1.0 leading up to RTM (see #7754), were blocking users of the MSTest V2 packages we had released for .NET Core 1.0 RC2. Not any more (see #10713), we are pleased to note.

This continues to be a preview release, and comes with following changes:

  1. dotnet-test-mstest is built against .NET Core 1.0 RTM.
  2. Deprecated support for netstandardapp1.5 moniker as announced here.
  3. Fixes for bugs reported by you:
    1. “the test suite returns an exit code of zero even when there are failing tests” (from a comment in our earlier post)
    2. “AssemblyCleanup throwing Exception in ASP.NET Core Project Targeting .NET 4.5.1” (from a comment on the forum)

Now let’s go through the same steps as enumerated in our earlier post.

Installing the SDK

Install the Visual Studio official MSI installer from

Creating a class library project

Create a .NET Core Class Library application. Open Visual Studio, and choose File | New | Project:


Adding references for MSTest

From, install the MSTest.TestFramework package (shown below).

mstestfxNow, install the runner – look for the updated dotnet-test-mstest package, and install it:


Open the project.json file in the solution. You will already see the packages you just installed mentioned under “dependencies”. Add the “testRunner” property and set that to “mstest”. To make it easier, just replace the content of the project.json file with the following (and note the differences in version numbers from our earlier post):

  "version": "1.0.0-*",

  "testRunner": "mstest",

  "dependencies": {
    "dotnet-test-mstest": "1.1.1-preview",
    "MSTest.TestFramework": "1.0.1-preview"

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0",
          "type": "platform"

Writing the tests

Visual Studio would have automatically created a file named Class1.cs. Open that file and replace its content with the following:

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SampleNetCoreUnitTests
  public class TestClass
    public void TestMethodPassing()

    public void TestMethodFailing()

Testing using the Visual Studio IDE

Open the Test Explorer window (Test | Windows | Test Explorer in Visual Studio). Build the solution, and you should see the tests as follows:

TED Click on “Run All” to run the tests. TEE

Testing using the .NET CLI

Open a command prompt and navigate to the folder containing the solution, and type dotnet test to execute the tests:dotnettestUse the dotnet test --list command to discover tests. dotnettestlistUse the dotnet test --test to execute specific tests. dotnettesttest

Testing using vstest.console.exe

The venerable vstest.console.exe may be used as well to run tests. Open a Developer Command Prompt, and just point vstest to the project.json file using the built-in Vsix based adapter to execute the tests: vstest.console.exe project.json /UseVsixExtensions:true vstestconsoleUse vstest.console.exe project.json /UseVsixExtensions:true /logger:trx to generate reports too.vstestconsolelogger

Testing using VSTS

To execute the tests in VSTS CI, check in the code and create a build definition with the following steps:

  1. a Command Line step that invokes the dotnet restore (i.e. “Tool” set to dotnet and “Arguments” set to restore)
  2. a Visual Studio Build step with the default settings
  3. a Visual Studio Test step, with “TestAssembly” set to **project.json, and “Other console options” set to /UseVsixExtensions:true /logger:trx

Queue up the build, and you should see the following:


Build completed, tests run (with one of the tests failing as expected), and test results published!


Thank you for the feedback you have given us till now. Not all the bugs/issues you reported may be fixed yet, but our endeavor is to address them in subsequent drops. In the meanwhile, please continue to send us your feedback as comments on this post, or using Visual Studio’s “Report a Problem”/”Provide a Suggestion” features, or using connect, or twitter.

Looking forward to hearing from you.


Discussion is closed.

Feedback usabilla icon