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
Related
I cannot install the Xero.NetStandard.OAuth2 Nuget package from either VS2017 or VS2019. The error is:
Could not install package 'Xero.NetStandard.OAuth2 3.16.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', 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.
While my web app is .NET Framework version 4.6.
The Xero NetStandard SDK targets .NET Standard 2.0 and is only compatible with .NET Framework > 4.6.1.
You can see all the compatible frameworks for .NET Standard 2.0 here:
.NET implementation support
When I tried installing Microsoft.AspNetCore.AppRef in my webapplication in .net core 3.1.
However, I get this error instead:
Package 'Microsoft.AspNetCore.App.Ref 3.1.3' has a package type 'DotnetPlatform' that is not supported by project 'xxxxxx'.
NU1213 The package Microsoft.AspNetCore.App.Ref 3.1.3 has a package type DotnetPlatform that is incompatible with this project.
Any ideas how to fix?
Acording to the package description on nuget:
This package is an internal implementation of the .NET Core SDK and is not meant to be used as a normal PackageReference.
Using NuGet Package Manager, I get this error message:
Could not install package 'Microsoft.Toolkit.Uwp.UI.Controls 3.0.0'.
You are trying to install this package into a project that targets 'native,Version=v0.0',
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. 0
The app is a Blank App (C++/winRT). Visual Studio 15.8.0 Preview 4.0.(10.0.17134.0, 10.0.17704.0)
Despite it's name, the Windows Community Toolkit is only intended for C# developers.
I try to add package via nuget but this error occurs;
Could not install package 'System.Security.Cryptography.Xml 4.4.2'.
You are trying to install this package into a project that targets
'.NETFramework,Version=v4.6', 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.
Ok message is clear but there is a code peace and I moved it to my project. How can I make it work ? it requires this library
public string SignXml(XmlDocument xmlDoc, X509Certificate2 uidCert)
{
try
{
// Create a SignedXml object.
SignedXml signedXml = new SignedXml(xmlDoc);
SignedXml is already available in .NET Framework, you just need to add a reference to System.Security.dll
The NuGet package is for .NET Core, but can be used by .NET Standard (2.0) libraries which run on .NET Core 2.0+ or .NET Framework 4.6.1+. (The .NET Framework implementation just forwards to System.Security.dll).
Alternatively, upgrade your minimum target to 4.6.1 or higher (4.6.1 is 2 and a half years old at this point... and at 4.6 you’re 5 versions out of date).
Trying to build a project with a reference to a package that should be compatible with .net core 1.1 but when nuget is restoring packages (VS.NET 2017 or the command line) I an see an error message
"One or more of the packages are incompatible with netcoreapp1.1"
The package name is
Microsoft.AspNetCore.DataProtection.AzureStorage
It says it is compatible with .NET Standard v1.5
And the error relates to dependencies of the package:
Microsoft.Data.Edm
Microsoft.Data.Services.Client
Microsoft.Data.OData
Microsoft.Data.Spatial
The csproj file has a package fallback setting:
<PackageTargetFallback>
$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;
</PackageTargetFallback>
Not sure what the problem is
thanks
Michael