Xunit: Unable to install Xunit.runner.visualstudio to a .NET Core Console App

Created on 20 Apr 2017  路  4Comments  路  Source: xunit/xunit

Xunit.runner.visualstudio depends on a out of date version of TestPlatform.ObjectModel which causes it to fail to install to a .NET Core Console App

Repro Steps:

  1. Use Visual Studio 2017 with .NET Core Cross-Platform Development workload
  2. Create a new C# Console App (.NET Core)
  3. Using Nuget Package Manager, attempt to install Xunit.runner.visualstudio v2.2.0

Error log:
'Package Restore failed. Rolling back package changes for 'ConsoleApp1'

Package Manager Output:

Restoring packages for c:\users\username\documents\visual studio 2017\Projects\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj...
  GET https://api.nuget.org/v3-flatcontainer/xunit.runner.visualstudio/index.json
  OK https://api.nuget.org/v3-flatcontainer/xunit.runner.visualstudio/index.json 235ms
  GET https://api.nuget.org/v3-flatcontainer/xunit.runner.visualstudio/2.2.0/xunit.runner.visualstudio.2.2.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/xunit.runner.visualstudio/2.2.0/xunit.runner.visualstudio.2.2.0.nupkg 235ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.testplatform.objectmodel/index.json
  OK https://api.nuget.org/v3-flatcontainer/microsoft.testplatform.objectmodel/index.json 234ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.testplatform.objectmodel/11.0.0/microsoft.testplatform.objectmodel.11.0.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.testplatform.objectmodel/11.0.0/microsoft.testplatform.objectmodel.11.0.0.nupkg 234ms
Installing System.Threading.Tasks.Extensions 4.0.0.
Installing System.Security.Cryptography.Csp 4.0.0.
Installing System.Security.Cryptography.Cng 4.2.0.
Installing System.Security.Cryptography.OpenSsl 4.0.0.
Installing System.Globalization.Extensions 4.0.1.
Installing System.Diagnostics.DiagnosticSource 4.0.0.
Installing runtime.native.System.Security.Cryptography 4.0.0.
Installing runtime.native.System.Net.Http 4.0.1.
Installing System.Reflection.Emit.Lightweight 4.0.1.
Installing xunit.runner.visualstudio 2.2.0.
Installing Microsoft.DotNet.PlatformAbstractions 1.1.0.
Installing Microsoft.Extensions.DependencyModel 1.1.0.
Installing System.Buffers 4.0.0.
Installing NETStandard.Library 1.6.0.
Installing System.Threading.ThreadPool 4.0.10.
Installing runtime.native.System.IO.Compression 4.1.0.
Installing Microsoft.TestPlatform.ObjectModel 11.0.0.
Installing System.Reflection.TypeExtensions 4.1.0.
Installing System.Runtime.InteropServices.RuntimeInformation 4.0.0.
Installing System.Dynamic.Runtime 4.0.11.
Installing Newtonsoft.Json 9.0.1.
Installing System.Runtime.Serialization.Primitives 4.1.1.
Installing Microsoft.Win32.Primitives 4.0.1.
Installing System.Globalization.Calendars 4.0.1.
Installing System.IO.Compression 4.1.0.
Installing Microsoft.CSharp 4.0.1.
Installing System.IO.Compression.ZipFile 4.0.1.
Installing System.Linq.Expressions 4.1.0.
Installing System.Reflection.Emit.ILGeneration 4.0.1.
Installing System.Net.Http 4.1.0.
Installing System.Reflection.Emit 4.0.1.
Installing runtime.native.System 4.0.0.
Installing System.Net.Primitives 4.0.11.
Installing System.Threading.Timer 4.0.1.
Installing System.Net.Sockets 4.1.0.
Installing System.ObjectModel 4.0.12.
Installing System.Reflection.Extensions 4.0.1.
Installing System.Security.Cryptography.Algorithms 4.2.0.
Installing System.Security.Cryptography.Encoding 4.0.0.
Installing System.Security.Cryptography.Primitives 4.0.0.
Installing System.Security.Cryptography.X509Certificates 4.1.0.
Package Microsoft.TestPlatform.ObjectModel 11.0.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.TestPlatform.ObjectModel 11.0.0 supports:
  - net35 (.NETFramework,Version=v3.5)
  - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Package restore failed. Rolling back package changes for 'ConsoleApp1'.
Time Elapsed: 00:00:05.8614174
========== Finished ==========

Workaround is to install Microsoft.Net.Test.SDK which installs Microsoft.TestPlatform.ObjectModel v15.0.0. You can then successfully install Xunit.runner.visualstudio.

FYI: @ManishJayaswal

Duplicate

Most helpful comment

.NET Standard is not .NET Core.

Your test project needs to be netcoreapp, not netstandard.

All 4 comments

This is already fixed in 2.3 beta 1.

I have installed latest versions 2.4 and I am still receiving this message:

warning NU1701: Package 'xunit.runner.visualstudio 2.4.0-beta.2.build4010' 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.

.NET Standard is not .NET Core.

Your test project needs to be netcoreapp, not netstandard.

Was this page helpful?
0 / 5 - 0 ratings