Reputation: 29227
I created a new Asp.Net core 2.0 project with API template using Visual Studio 2017 V15.7.3. However, the newly created project cannot be compiled and it got the following error.
However, I did the same on another machine and it compiles.
Severity Code Description Project File Line Suppression State Error NU1202 Package System.Security.Cryptography.X509Certificates 4.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Security.Cryptography.X509Certificates 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Net.Primitives 4.0.11 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Net.Primitives 4.0.11 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - win8 (Windows,Version=v8.0) - wp8 (WindowsPhone,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Reflection.Metadata 1.3.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Reflection.Metadata 1.3.0 does not support any target frameworks. Error NU1202 Package System.Threading.Timer 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Threading.Timer 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net451 (.NETFramework,Version=v4.5.1) - portable-net451+win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile151) - win81 (Windows,Version=v8.1) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Threading.Thread 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Threading.Thread 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - netcore50 (.NETCore,Version=v5.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Collections.Concurrent 4.0.12 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Collections.Concurrent 4.0.12 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111) - win8 (Windows,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Security.Cryptography.Encoding 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Security.Cryptography.Encoding 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Diagnostics.Tracing 4.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Diagnostics.Tracing 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111) - win8 (Windows,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.AppContext 4.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.AppContext 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - netstandard (.NETStandard,Version=v0.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Collections.Immutable 1.2.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Collections.Immutable 1.2.0 does not support any target frameworks. Error NU1202 Package System.Xml.XmlSerializer 4.0.11 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Xml.XmlSerializer 4.0.11 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - win8 (Windows,Version=v8.0) - wp8 (WindowsPhone,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Runtime.InteropServices.RuntimeInformation 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Runtime.InteropServices.RuntimeInformation 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Security.Principal 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Security.Principal 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - win8 (Windows,Version=v8.0) - wp8 (WindowsPhone,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Text.Encoding.CodePages 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Text.Encoding.CodePages 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Net.Sockets 4.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Net.Sockets 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Security.Cryptography.Csp 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Security.Cryptography.Csp 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Security.Cryptography.Primitives 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Security.Cryptography.Primitives 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Diagnostics.Contracts 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Diagnostics.Contracts 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - win8 (Windows,Version=v8.0) - wp8 (WindowsPhone,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.IO.Compression 4.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.IO.Compression 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111) - win8 (Windows,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Runtime.Loader 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Runtime.Loader 4.0.0 supports: net462 (.NETFramework,Version=v4.6.2) Error NU1202 Package System.Globalization.Calendars 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Globalization.Calendars 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Threading.Overlapped 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Threading.Overlapped 4.0.1 does not support any target frameworks. Error NU1202 Package Microsoft.Win32.Primitives 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.Win32.Primitives 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Threading.ThreadPool 4.0.10 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Threading.ThreadPool 4.0.10 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - netcore50 (.NETCore,Version=v5.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package Microsoft.Win32.Registry 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.Win32.Registry 4.0.0 does not support any target frameworks. Error NU1202 Package System.Xml.XPath 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Xml.XPath 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Threading.Tasks.Dataflow 4.6.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Threading.Tasks.Dataflow 4.6.0 does not support any target frameworks. Error NU1202 Package System.Diagnostics.Process 4.1.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Diagnostics.Process 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Linq.Parallel 4.0.1 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Linq.Parallel 4.0.1 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111) - win8 (Windows,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Console 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Console 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Security.Cryptography.Algorithms 4.2.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Security.Cryptography.Algorithms 4.2.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Error NU1202 Package System.Diagnostics.FileVersionInfo 4.0.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package System.Diagnostics.FileVersionInfo 4.0.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) Warning NU1701 Package 'System.Linq.Queryable 4.0.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. Watcher C:\Users\wangyi\source\repos\Strats\Watcher\Watcher.csproj 1 Warning NU1701 Package 'System.Xml.XmlSerializer 4.0.11' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. Watcher C:\Users\wangyi\source\repos\Strats\Watcher\Watcher.csproj 1
Tried to reinstall VS 2017 and it stil have the same issue.
Update: dotnet new webapi
got the same errors
PS C:\TEMP> dotnet new webapi The template "ASP.NET Core Web API" was created successfully. This template contains technologies from parties other than Microsoft, see https://aka.ms/template-3pn for details. Processing post-creation actions... Running 'dotnet restore' on C:\TEMP\TEMP.csproj... Restoring packages for C:\TEMP\TEMP.csproj... Restoring packages for C:\TEMP\TEMP.csproj... C:\TEMP\TEMP.csproj : error NU1202: Package System.Text.Encoding.CodePages 4.0.1 is not compatible with netcoreapp2.0 (. NETCoreApp,Version=v2.0). Package System.Text.Encoding.CodePages 4.0.1 supports: C:\TEMP\TEMP.csproj : error NU1202: - monoandroid10 (MonoAndroid,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: - monotouch10 (MonoTouch,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: - xamarinios10 (Xamarin.iOS,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: - xamarinmac20 (Xamarin.Mac,Version=v2.0) C:\TEMP\TEMP.csproj : error NU1202: - xamarintvos10 (Xamarin.TVOS,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: Package System.Diagnostics.Contracts 4.0.1 is not compatible with netcoreapp2.0 (.NE TCoreApp,Version=v2.0). Package System.Diagnostics.Contracts 4.0.1 supports: C:\TEMP\TEMP.csproj : error NU1202: - monoandroid10 (MonoAndroid,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: - monotouch10 (MonoTouch,Version=v1.0) C:\TEMP\TEMP.csproj : error NU1202: - net45 (.NETFramework,Version=v4.5)
Upvotes: 1
Views: 1248
Reputation: 2682
not sure if you are still seeing the issue, but clearing the nuget cache resolved this for me.
From Visual Studio you can
or you can run
nuget locals all --clear
Upvotes: 3
Reputation: 239460
For some reason NuGet is pulling .NET Framework packages. Ensure that the only referenced package is Microsoft.AspNetCore.All
. If there are specific other packages that you actually intended to reference, ensure that those are actually compatible with .NET Core. If they require .NET Framework, NuGet's going to try to pull the .NET Framework specific packages, which won't work when targeting Core.
Upvotes: 0