I created a blank solution with framework 4.6.1 and add a project core 2.0. This error show in output for many package 'Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)'. How Can I Fix it?
Couple of things you could try to make it work, provided the packages that you are trying to install really do support .NET CORE 2.0.
If this doesn't work you can try deleting the local packages cache, which most likely is at the following location:
C:\Users{Your_User_Name}.nuget\packages
and try restoring the packages again.
If you still face the same problem, make sure your setup of .NET Core 2.0 SDK and VS2017 was entirely successful. If unsure, you can try reinstalling the same.
Your last bet is tinkering with the package itself. As you would have guessed by now this is more of a hack than an actual solution. Go to the above mentioned location and find the package that's giving errors while restoring (a folder with the same name as the package). Within the package, find and edit the {Package Name}.nuspec file and add the following tag:
group targetFramework=".NETStandard2.0"
and add content to it by copying from the "group targetFramework=".NETStandard1.0" tag. Save and close. Open the lib folder within the same directory and create a copy of the netstandard1.0 folder and rename the copy as netstandard2.0
Hope this helps.
Steps I tried before this (one of them may help someone else)
The solution that worked for me is below.
I spent a lot of time on this, and now (seemingly thanks to my nuget cache being in a happy state), I can create new projects without this issue!
I posted about this on reddit and tried many solutions:
.nuget
folder located at %userprofile%\.nuget
.Solution
But I fixed it! After lots of searching, I decided to search for the error code rather than the error message, I found this GitHub issue and followed hgrewa's advice.
If all of the above steps I tried didn't work for you, try following hgrewa's advice:
Microsoft.AspNetCore.All
Microsoft.AspNetcore.All
through NuGet. It's big so it might take a while to restore all of the packages.You should now be able to create new web projects without this issue occurring. I hope this helps someone and saves you the 5-6 hours it has taken me to sort this out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With