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
xunit failing after upgrading to .net core 1.1 #1031
Comments
I checked it out and it turns out that you have to add a dependency to your project:
Or a element if you're using the RC of VS2017 |
It works if you add InternalAbstractions 1.0.0 but it should also work with v 1.1.0. This would require a new release, right? |
Not that I have noticed. I added it to my project and the tests run just fine. |
For me it only works with
If I add
it gives the error reported on this issue. |
I needed to add version |
@wmeints Are the target assemblies built with net core 1.0 or 1.1? Downgrading xunit to use .net core 1.0 results in error "One or more projects are incompatible with .NETCoreApp,Version=v1.0 (win81-x64)" |
@DemoBytom Thanks. Adding reference to "Microsoft.DotNet.InternalAbstractions": "1.0.500-preview2-1-003177" solved the problem. |
We're retiring |
When I add "xunit.runner.visualstudio": "2.2.0-beta4-build1194" dependency and remove dotnet-test-xunit, I get Errors in C:\XXXXXUnitTest.xproj |
Sorry, I thought you were using the Preview 3 tooling (MSBuild), not the Preview 2.1 tooling ( |
This is roughly what you should have for preview 2.1 tooling: {
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {
"xunit": "2.2.0-beta4-build3444",
"dotnet-test-xunit": "2.2.0-preview2-build1029"
},
"testRunner": "xunit",
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": [
"dotnet5.4",
"portable-net451+win8"
]
}
}
} $ dotnet --version
1.0.0-preview2-1-003177 That imports section is not strictly required for xUnit.net, but there are other things you're using where it probably will be useful. |
I've updated my Without, xunit fails with |
I did not test inside Visual Studio, only from the command line. |
Even when running from the console I get Unless I add In Visual Studio the tests are not even discoveried untill the afromentioned line is added. We're still using tooling from preview 2, we plan to move to preview 3, but I'm not sure when (not my decision :( ) |
I narrowed the problem down, a bit. It doesn't break every time, the example bradwilson posted indeed works. But if i add a reference to
Removing the line or switching back to |
Just to confirm: My project uses ASP.NET Core MVC 1.1. |
To confirm adding "Microsoft.DotNet.InternalAbstractions": "1.0.0" to XUnit project solved the problem |
I have the same problem and created a reproduction repo here: https://github.com/hiiru/dotnet-test-exception the problem is caused by a dependency on Microsoft.Extensions.DependencyModel 1.1.0-* It's also hard to spot at first because inside visual studio, those tests just disappear, the error is only visible when running it on the console itself. |
Adding Microsoft.DotNet.InternalAbstractions was the solution used by the ASP.NET Core MVC test project: https://github.com/aspnet/Mvc/blob/dev/test/Microsoft.AspNetCore.Mvc.Test/project.json#L9 |
I kept having issues discovering the tests within Visual Studio's Test Explorer even with Microsoft.DotNet.InternalAbstractions. I was missing updating the SDK version in the global.json file:
Microsoft.DotNet.InternalAbstractions in conjunction with the SDK version pointing to the 1.1 SDK tools got everything working. |
You should always, always have a Always. |
dependency was missing: xunit/xunit#1031
I can confirm this is still a problem. Even after installing
|
FYI, we no longer officially support |
I'm not using project.json I'm just using out of the box .net core library template from VS 2017 |
Do these instructions not work correctly for you? https://xunit.github.io/docs/getting-started-dotnet-core.html |
They did, I had to upgrade to xunit 2.3.0-beta2-build3683. Comandline dotnet xunit works fine. Hope yo can release 2.3.0 soon. But I'm getting strange issue with resharper 2017.1.2 it won't run xunit tests from within the UI. It says: |
We have no responsibility for the Resharper runner. You should report issues with it to the JetBrains team. |
I've found the issue with the project. xunit 2.2 is ok with netcoreapp1.1 but you have to use the Xunit template provided in VS2017 which includes this nuget (which I was missing): https://www.nuget.org/packages/microsoft.net.test.sdk/15.0.0 That makes it work with Resharper. Anyway I'm glad the goose chase is over. Thanks for your help, Brad. |
To summarise; after reading this thread, I had success from adding the following packages: |
There should be no need for the |
@bradwilson the first line in the first comment here suggests it's the solution. So I had added this first. I have removed it now. I also got it working with xunit.runner.visualstudio 2.2.0. Not sure why it was previously telling me 2.2.0 was incompatible with netcoreapp 1.1, but after starting a new project and choosing "xUnit Test Project (.NET Core)" it all seemed to work fine without me needing to add or change anything. |
2.2.0 should be fine with 1.1. There were issues related to 2.0 that I attempted to fix in 2.3 beta 4, and actually fixed in 2.3 beta 5 (not yet shipped), that could affect both 1.x and 2.x tests. |
I have the same problem and created a reproduction repo here: https://github.com/hiiru/dotnet-test-exception the problem is caused by a dependency on Microsoft.Extensions.DependencyModel 1.1.0-* |
Closed for age. |
UPDATE: As suggested by @DemoBytom, Adding reference to "Microsoft.DotNet.InternalAbstractions": "1.0.500-preview2-1-003177" solved the problem.
After upgrading my solution to .net core 1.1 runtime, my visual studio 2015 IDE is throwing following exceptions; Any ideas on when xunit will be compatible with .net 1.1?
Compiling XXXXUnitTest for .NETCoreApp,Version=v1.1
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:01.8052505
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'Microsoft.DotNet.InternalAbstractions, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
at Xunit.Runner.DotNet.Program.GetAvailableRunnerReporters()
at Xunit.Runner.DotNet.Program.Run(String[] args)
at Xunit.Runner.DotNet.Program.Main(String[] args)
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.
The text was updated successfully, but these errors were encountered: