I've got a project that I want to use .net core 2.0, which I believe is netcoreapp2.0. It is also using a nuget package that is created with .net 4.6.1. I have control over this nuget package and can change something there if need be. It does have netstandards 2.0 imported as a nuget package.
If I include in my cproj file:
<TargetFramework>netcoreapp2.0</TargetFramework>
I get this warning :
Package 'Terryberry.Roes.Common 2017.9.29-mongo' 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.
along with errors about system.net.sockets being downgraded from 4.3 to 4.1. The 4.6.1 nuget package has System.Net.Sockets 4.3 so I'm not sure why it wants to downgrade.
The exact error for reference:
Detected package downgrade: System.Net.Sockets from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. MyNetCoreProject (>= 2017.2.0) -> Microsoft.VisualStudio.Web.BrowserLink (>= 1.1.2) -> Microsoft.Extensions.FileProviders.Physical (>= 1.1.1) -> NETStandard.Library (>= 1.6.1) -> System.Net.Sockets (>= 4.3.0) MyNetCoreProject (>= 2017.2.0) -> Microsoft.VisualStudio.Web.BrowserLink (>= 1.1.2) -> System.Net.Sockets (>= 4.1.0) MyNetCoreProject
I tried targeting both:
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
This gives me warnings like :
Package 'My461NugetPackage' 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.
This confuses me too because now I added net461 and it says its going to build it with .NetCoreApp
There are still errors about downgrading System.Net.Sockets
I then decided I was willing to try just net461. Just to see if it would compile. It does, but I get a runtime error.
<TargetFramework>net461</TargetFramework>
This gave me:
Unhandled Exception: System.TypeLoadException: Method 'ConfigureAppConfiguration' in type 'Microsoft.AspNetCore.Hosting.WebHostBuilder' from assembly 'Microsoft.AspNetCore.Hosting, Version=1.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
I've tried doing some research, but there is a lot of old/obsolete information about there as .net core is evolving. I haven't been able to figure this out. Any guidance would be appreciated.
net461
andnetstandard2.0
? – Tseng