Reputation: 39354
I created a ASP.NET Core RC2 class library and on project.json I have:
"frameworks": {
"net461": { },
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
}
},
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
}
I used it on an ASP.Net Core RC2 web application which project.json has:
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"TestLibrary": "1.0.0",
},
"frameworks": {
"net461": { }
},
NOTE: I omitted the other dependencies for sake of simplicity.
I get the following error when trying to restore the Web Project:
The dependency TestLibrary 1.0.0 does not support framework .NETFramework,Version=v4.6.1.
What am I missing?
UPDATE
I changed my TestLibrary configuration to:
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
},
"frameworks": {
"netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net452+win81"
]
}
}
But I have a class library project name TestLibraryTests with tests:
"testRunner": "xunit",
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"xunit": "2.2.0-beta1-build3239",
"dotnet-test-xunit": "1.0.0-rc2-build10015",
"TestLibrary": "1.0.0"
},
"frameworks": {
"netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net452+win81"
]
}
}
But now I get the error:
Package dotnet-test-xunit 1.0.0-rc2-build10015 is not compatible with netstandard1.5 (.NETStandard,Version=v1.5). Package dotnet-test-xunit 1.0.0-rc2-build10015 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netcoreapp1.0 (.NETCoreApp,Version=v1.0)
One or more packages are incompatible with .NETStandard,Version=v1.5.
What am I missing? I can't use XUnit with RC2?
Upvotes: 1
Views: 1572
Reputation: 5634
When you add a class library package, make sure you are choosing the .NET Core-->Class Library, but also make sure you choose the right target framework from the dropdown circled red in the imaged below.
Your project.json should then look like this:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net452+win81"
]
}
}
}
Upvotes: 1
Reputation: 529
When I tried using the package directly without installing the .NET Core RC2 first I got the same error :)
Blog Post: https://blogs.msdn.microsoft.com/dotnet/2016/05/16/announcing-net-core-rc2/
Upvotes: 1