I had a similar problem and found a solution. I post it here if it helps someone. What I found out is that using net461-oriented xproj library to test the Asp.Net Core Project (.Net Framework) with Net461 targeting and the 4.1 class targeting platform works, but the setup seems very thin and fragile. The key insight for me came from this thread https://github.com/aspnet/Tooling/issues/245 , where @BradRem pointed out that the project folder structure seems to be the source of the problems.
Initially, I tried unsuccessfully to use this folder structure:
CSI
____ Project Net Project Project Core Project (.Net Framework)
____ Advertising platform for the Windows 4.61 class library
test
____Core library used to run xUnit tests
But when I tried to run the tests using this folder structure, he threw an exception that starts as follows:
Unable to start C:\Program Files\dotnet\dotnet.exe dotnet-test Error: 0 : [ReportingChannel]: Waiting for message failed System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.IO.Stream.ReadByte() at System.IO.BinaryReader.ReadByte() at System.IO.BinaryReader.Read7BitEncodedInt() at System.IO.BinaryReader.ReadString() at Microsoft.DotNet.Tools.Test.ReportingChannel.ReadMessages()
But when I switched to the following folder structure, I was able to make it work:
CSI
____ Project Net Project Project Core Project (.Net Framework)
____ Size for targeting the Windows 4.61 class library
____Core library used to run xUnit tests
Thus, the key was placed in the folder in which the library of testing classes was located, in the src folder, where other project folders were located.
However, another thing that seemed to matter a lot was to add links to two other projects to the Core Library test project at the same time, and not one at a time.