-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet test in IDE mode fails during discovery of net451 tests and only attempts to run for the first defined target framework #900
Comments
I was getting this error and it seemed to be that netcoreapp1.0 had to come before my net46 framework dependency. My project.json framework section now looks like: "frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
},
"net46": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1"
}
}
} |
@Romanx But, with that change, is Test Explorer able to run your tests for both netcoreapp1.0 and net46? |
The limitation of running just the first framework is out of our control, unfortunately. The Microsoft team responsible for this is aware of this current limitation. |
The socket issue is something that doesn't look like us, and should probably be reported to Microsoft. |
@bradwilson Could the "first framework-only" limitation be documented under the "Targeting desktop .NET" section on this page please? |
My situation seems very similar and I could use some help. Here is my project.json for my Test library:
And here are the exceptions produced in the output window of VS2015 when trying to run tests:
I'm trying to use this xproj library to hold my xunit tests which I want to run against the following two projects: wwwGiftOasisResponsive Asp.Net Core Project (.Net Framework) project that targets Net461 and MP_Prims which is a Windows class library which targets framework 4.61. Questions |
I found a solution to my issue and am posting it here in case it helps someone. What I have learned is that using an xproj library targeting net461 to test an Asp.Net Core Project (.Net Framework) project targeting net461 and a a Windows class library targeting framework 4.61 works but the setup seems to be very finicky and fragile. The key insight for me came from this thread aspnet/Tooling#245 where @BradRem indicated that the folder structure of the projects seemed to the source of issues. Initially I tried unsuccessfully to use this folder structure:
But when I tried to run the tests using this folder structure it produced the exception I previously posted. But when I changed to the following folder structure I was able to get it to work:
So the key was putting the folder that housed the testing class library in the src folder where the other projects folders were. That said, the other thing that seemed to make a big difference was to add the references to the other two projects to the Core Library test project at the same time rather than one at a time. |
this thread might also help: https://github.com/dotnet/cli/issues/4784 |
Closed for age. |
Sample project/commit to reproduce this issue: plioi/parsley@513cc2f
As of that commit, I can run the tests in Test Explorer as expected. The Output pane shows all 115 tests discovered and executed within bin\Debug\netcoreapp1.0. At the command line, all 115 tests are correctly run twice, once for each of the two defined target frameworks.
At this point, I was surprised, though, that it wasn't also running another 115 for net451 when run in Test Explorer. From the documentation: "You can target both net4xx and netcoreapp simply by adding both frameworks together in your project.json file. When you run dotnet test with multiple framework entries, the system will run all your framework tests, one after another." That statement may only apply to the console mode.
As of the linked commit, my tests' project.json is this:
Since Test Explorer was only attempting to run this for netcoreapp1.0, I figured I was merely bumping into a limitation on the Microsoft side of the VS/xunit handshake, so I attempted to swap the order of the two framework descriptions in the project.json, so that the net451 section came first. The Output pane shows an attempt to discover within bin\Debug\net451 this time, but then fails:
I have two questions:
dotnet test
in IDE mode mistakenly run only one defined framework, unlike when I run it at the command line, in which case I should create an issue to the dotnet CLI team? Or, is that part in xUnit's control?The text was updated successfully, but these errors were encountered: