5

I know this question is asked multiple times, but due to many changes in .NET Core, they become obsolete.

I have simple .NET Core library targeting Core (not Full .NET), now I want to configure Tests project for it.

Both projects compiles without problem, but I could not get tests to show up in Test Explorer in Visual Studio 2015.

Below are project.json files I managed to assemble from multiple documentation sources.

Do you see anything missing, perhaps some dependency?

===================

I am using :

  • Visual Studio 2015 Update 3
  • .NET Core 1.0.0 RC2

MyProject.dll

project.json

{ "version": "1.0.0-*", "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" } }, "frameworks": { "netcoreapp1.0": { "imports": "dnxcore50" } } } 

MyProject.Tests.dll

project.json

{ "version": "1.0.0-*", "dependencies": { "xunit.runner.dnx": "2.1.0-rc1-build204", "MyProject": "1.0.0-*", "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" }, "xunit": "2.2.0-beta4-build3444" }, "frameworks": { "netcoreapp1.0": { "imports": "dnxcore50" } } } 
2
  • 2
    ".NET Core 1.0.0 RC2"? Are you serious? Now it should be 1.0.3 at least. Commented Dec 12, 2016 at 12:50
  • 1
    Thank's for pointing out, .NET Core is following JavaScript example - few month is entirety. :) Commented Dec 12, 2016 at 13:00

1 Answer 1

2

In my particular case (At least i don't have issues launching tests from VS or console) xunit related dependencies look like this:

"dotnet-test-xunit": "2.2.0-preview2-build1029", "xunit": "2.2.0-beta2-build3300", "xunit.extensibility.execution": "2.2.0-beta2-build3300", "xunit.runner.visualstudio": "2.2.0-beta2-build1149", 

Don't pay attention to spesific versions. I believe xunit.runner.visualstudio package is what you need here

Sign up to request clarification or add additional context in comments.

1 Comment

Try to add "testRunner": "xunit" ** to your project.json file. There is a universal approach as well, just run **dotnet new -t xunittest to create brand new xunit project which is being detected in VS for sure and compare the project.json with yours.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.