Reputation: 2357
I am writting a .NET Core library I intend to publish on NuGet, full .NET compatible.
To do so, I set the project.json as follow:
"frameworks": {
"netstandard1.1": {
"imports": "dnxcore50"
}
}
I want that library to use a full .NET library (let's call it OtherLib
). I thought it could be possible as long as the .NET version of OtherLib would be compatible with the netstandard version of my library.
But it appears not... Here is the error:
Package OtherLib X.Y.Z is not compatible with netstandard1.1 (.NETStandard,Version=v1.1). Package OtherLib X.Y.Z supports:
- net40 (.NETFramework,Version=v4.0)
- net45 (.NETFramework,Version=v4.5)
Here is my full project.json:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0",
"OtherLib": "X.Y.Z"
},
"frameworks": {
"netstandard1.1": {
"imports": "dnxcore50"
}
}
}
I suspect there is some tricky stuff to do in it, to get it working, or may be it is simply not possible?
Thanks in advance. (Excuse me for my english, I am not a native speaker)
Upvotes: 0
Views: 218
Reputation: 244998
I thought it could be possible as long as the .NET version of OtherLib would be compatible with the netstandard version of my library.
No, it's not possible. Versions of .Net Framework are supersets of versions of .Net Standard. Since OtherLib
is a .Net Framework library, you can't depend on it in a .Net Standard library.
You will either have to limit your library to run only on .Net Framework, or you will have to remove the dependency on OtherLib
. (Possibly by making two versions of your library: one for .Net Standard that does not depend on OtherLib
and one for .Net Framework that does.)
Upvotes: 1
Reputation: 66
Try to modify your project.json by changing "netstandard1.1" to "net45":
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0",
"OtherLib": "X.Y.Z"
},
"frameworks": {
"net45": {
"imports": "dnxcore50"
}
}
}
Upvotes: 1