On dotnet restore we are receiving the following error:
Package Microsoft.AspNet.SomePackage 5.6.7 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.AspNet.SomePackage 5.6.7 supports: net45 (.NETFramework,Version=v4.5)
Our project.json looks like this:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNet.SomePackage": "5.6.7",
"Microsoft.NETCore.App": "1.0.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50",
"portable-net451+win8"
]
}
},
"runtimes": {
"win8-x64": {}
}
}
How can we dotnet restore and dotnet run in a way that runs our app?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Note – by adding “net451” to the framework imports I was able to make it work.
"frameworks": {
"netcoreapp1.0": {
"imports": [
"net451",
"dotnet5.6",
"portable-net45+win8"
]
}
},
I took it from here
Method 2
The short answer is, you can’t. In some narrow cases you can use imports to override nuget’s built in dependency rules. In this case you cannot, .NET Framework and .NET Core are incompatible. The errors says the package only supports net45 (.NET Framework 4.5). You cannot use it with your .NET Core application
Method 3
If you need to do the same thing but are using the new .csproj for configuration rather than the project.json, edit your .csproj file and add the following right below the propertygroup:
<PropertyGroup>
<PackageTargetFallback>net451;dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
Taken from here.
Method 4
requirejs is on github (https://github.com/requirejs/requirejs) and it is possible to compile it with core as dependency.
If the package is open source or the source is available then it is possible to recompile with dot net core instead for 4.5 framework.
It all depends on other other dependencies and their compatibility with dotnet core.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0