ASP.NET 5 Class Library (Package) fails to create - asp.net-core

I'm adding a new project as Class Library (Package) to my solution and I'm getting errors in project.json.
.NET Platform 5.4 error NU1001: The dependency Microsoft.CSharp >= 4.0.1-beta-23516 could not be resolved.
.NET Platform 5.4 error NU1001: The dependency System.Collections >= 4.0.11-beta-23516 could not be resolved.
1>C:\Projects\iSeekDevelopments\Source\ISeek.MyProperty.Core\project.json(15,24,15,24): .NET Platform 5.4 error NU1001: The dependency System.Linq >= 4.0.1-beta-23516 could not be resolved.
.NET Platform 5.4 error NU1001: The dependency System.Runtime >= 4.0.21-beta-23516 could not be resolved.
.NET Platform 5.4 error NU1001: The dependency System.Threading >= 4.0.11-beta-23516 could not be resolved.
Why does it try to reference 4.0.11-beta-23516?
How could it be fixed?

Running dnu restore fixed the issue.

Related

NU1608 Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires

In the solution that I have to work with, I have to add a test harness for a number of library projects.
It has to be a .NET Core 2.1 (and it will stay this way for the reasons beyond my control) ASP.NET web service.
NU1608 Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires Microsoft.AspNetCore.Razor.Design (>= 2.1.1 && < 2.2.0) but version Microsoft.AspNetCore.Razor.Design 2.2.0 was resolved.
I created a brand new project of the type "Asp Net Core Web Application", and when I built, I got the error above.
What is the meaning and reason of this error in a brand-new project created by VS?
You are getting this issue, because while your Microsoft.AspNetCore.Razor.Design version is 2.2.0 but ASP.NET Core application is still at 2.1.
You just need to change your package Microsoft.AspNetCore.Razor.Design2.2.0 to Microsoft.AspNetCore.Razor.Design2.1.x in your project file.
The issue described in Microsoft documentation as NuGet Warning NU1608:
A resolved package is higher than a dependency constraint allows. This
means that a package referenced directly by a project overrides
dependency constraints from other packages.
Possible solution:
Update the package version according to its dependency constraints.
For example in this case:
Update Microsoft.AspNetCore.Razor.Design 2.2.0 to 2.1.x according to its dependency Microsoft.AspNetCore.App 2.1.1

install System.Net.Http to .net framework 4.0 project

I need use AuthenticationHeaderValue for getting token
var token = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}")));
so I have to install System.Net.Http package but when I install it via package manager console it give that error
what should I do?
what is AuthenticationHeaderValue alternative?
Could not install package 'System.Net.Http 4.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework.
Install System.Net.http version which is compatible to your .Net Framework

System.ComponentModel.DataAnnotations - reference

I'm converting a .net core 1.0 project to 2.2 net core
There is a reference to System.ComponentModel.DataAnnotations I'm trying to resolve, has this been factored into a seperate nuget package in .net core
Error CS0234 The type or namespace name 'DataAnnotations' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)
Adding references to Microsoft.AspNetCore.App and Microsoft.AspNetCore.All cleared the error.

Where do I find system.web.Http in .NET CORE 2.0 project

i need use System.Web.Http in my project.
I found that Microsoft.AspNet.WebApi.Core package has it, but in NET core project I have error:
Package 'Microsoft.AspNet.WebApi.Core 5.2.4' 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.
Can you help?

Latest nuget packge for FluentAssertions missing System.Xml references

FluentAssertions nuget package for 1.7 seems to be missing the references for System.Xml and System.Xml.Linq
Is anyone else experiencing this problem?
If you get the latest NuGet package (1.7.1.1), you'll find that your problem is fixed now.