JsonKnownTypes icon indicating copy to clipboard operation
JsonKnownTypes copied to clipboard

Want to target .NET version 4.6.1

Open theglobe opened this issue 5 years ago • 10 comments

I get the following error when trying to install through NuGet: Could not install package 'JsonKnownTypes 0.4.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

theglobe avatar Jun 03 '20 12:06 theglobe

.Net framework 4.6.1 isn't compatible with .net standard 2.0. You need at least .Net framework 4.6.2. But i will add support for 4.6.1 version

dmitry-bym avatar Jun 03 '20 13:06 dmitry-bym

Thanks!

theglobe avatar Jun 03 '20 15:06 theglobe

According to https://docs.microsoft.com/en-us/dotnet/standard/net-standard the minimum for .NET Standard 2.0 is .NET Framework 4.6.1, or am I reading something wrong?

theglobe avatar Jun 03 '20 16:06 theglobe

Note the footnote for that entry:

2 The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.

bddckr avatar Jun 03 '20 16:06 bddckr

Will there be any issues with JsonKnownTypes and .NET Framework 4.6.1? Newtonsoft.Json works, so I hope this will work too.

theglobe avatar Jun 03 '20 16:06 theglobe

Created a pull request, #16

theglobe avatar Jul 03 '20 15:07 theglobe

Is there any activity here? :)

theglobe avatar Oct 10 '20 12:10 theglobe

@theglobe I checked it, #16 it is good but i need to add not just .NET Framework 4.6.1. I think i need to add all platforms which are use in Json.NET but i can't do it now, sorry. I have a looot of work)

dmitry-bym avatar Oct 16 '20 09:10 dmitry-bym

Work is everywhere 👍

I did a small investigation into which frameworks can be added with the least amount of effort and checked which frameworks Newtonsoft.Json targets, they are: net45;net40;net35;net20;netstandard1.0;netstandard1.3;netstandard2.0

JsonKnownTypes Without rewriting anyting in JsonKnownTypes, we can target net461;net46;net45;netstandard2.0 (Targeting all of Newtonsofts frameworks gives errors for some of the frameworks.)

Targeting for example netstandard1.3 gives errors such as 'Attribute' does not contain a definition for 'GetCustomAttribute'

JsonKnownTypes.UnitTests For the test project, Newtonsoft.Json.Test targets net46;net40;net35;net20;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1 Which are not compatible with some packages used in JsonKnownTypes.UnitTests, giving errors like Package AutoFixture 4.11.0 is not compatible with net40

Why do they target more in their Test project, e.g. net46?

Without changing anyting in JsonKnownTypes.UnitTests, we can target net461;net46;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1

JsonKnownTypes.Benchmark And similarly; Without changing anyting in JsonKnownTypes.Benchmark, we can target net461;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1

theglobe avatar Nov 12 '20 16:11 theglobe

See https://github.com/dmitry-bym/JsonKnownTypes/pull/18

theglobe avatar Nov 12 '20 16:11 theglobe