Nuget Package cannot be installed in NET Core v1.1 Project - asp.net-core

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

Related

Can't install the Xero.NetStandard.OAuth2

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

Failure to Install Microsoft.AspNetCore.AppRef

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.

Is the nuget package Microsoft.AspNet.WebApi.Core 5.2.7 compatible with .Net Core 2.2?

I am getting the following warning in my .NET Core 2.2 application:
Warning NU1701 Package 'Microsoft.AspNet.WebApi.Core 5.2.7' was restored using
'.NETFramework,Version=v4.6.1' instead of the project target framework
'.NETCoreApp,Version=v2.2'.
This package may not be fully compatible with your project.
Are there any alternatives for this package?
As said in comments, this is not needed for a ASP.NET Core project. Remove it via NuGet and you should be good to go.

need dotnet core 2.1 to show up in visual studio

When I try to upgrade ASP.NET Core in Nuget package manager, I get the following error:
Severity Code Description Project File Line Suppression State
Error Package Microsoft.AspNetCore.All 2.1.0-preview2-final is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.AspNetCore.All 2.1.0-preview2-final supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) 0
I have installed the sdk multiple times, so I'm confused because when I go to target it only has up to dotnet core 2.0 as an option. I installed visual studio preview but that hasn't helped either. Any suggestions?
For .NET Core 2.1 you need (currently) version 2.1.300-rc1 of the sdk. The version numbers of the SDK and .NET Core are not in sync, older 2.1 versions of the SDK are not enough.
This version can be downloaded from here: https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1
You can check the version on command line with donet --version command. dotnet --info will also list all the installed runtimes and SDKs.
> dotnet --version
2.1.300-rc1-008673

'MySql.Data' already has a dependency defined for 'System.Text.Encoding.CodePages' [duplicate]

I'm trying to add AutoMapper as a dependency to a project using NuGet on Visual Studio Premium 2012, but it fails.
It says:
Operation failed
'AutoMapper' already has a dependency defined for
'Microsoft.CSharp'.
I'm able to add other dependencies.
I'm using the last version of the package manager for VS 2012:
NuGet Package Manager 2.8.60318.667
Any ideas what should I check?
The problem is that your NuGet Package Manager is too old. You need NuGet 2.12 since this supports the newer .NETStandard frameworks that the AutoMapper 5.0.1 NuGet package is using.
The AutoMapper has a group dependency which specifies a target framework of .NETStandard. Since your version of NuGet Package Manager is too old it does not recognise this target framework and converts it to an Unknown target framework and you end up with duplicate frameworks since there .NETStandard is used a few times in that NuGet package. This causes the error:
'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'
Unfortunately NuGet 2.12 is not available for Visual Studio 2012 but is available for Visual Studio 2013.
So either you need to update to Visual Studio 2013 or above, or you will have to use the older AutoMapper NuGet package which does not support .NETStandard.
Seems to be a problem with the current version of automapper:
AutoMapper 5.0.0 Tuesday, June 28, 2016
I tried with the previous version and it works:
PM> Install-Package AutoMapper -Verbose
Install-Package : 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:16
+ Install-Package <<<< AutoMapper -Verbose
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> Install-Package AutoMapper -Version 4.2.1
Installing 'AutoMapper 4.2.1'.
Successfully installed 'AutoMapper 4.2.1'.
So, if you can't update NuGet Package Manager, the answer is:
PM> Install-Package AutoMapper -Version 4.2.1
I ended up needing to update NuGet.exe that was included in the solution to be able to build NuGet packages by running:
nuget.exe update -self
I had the same issue on VS2013. I had to update to VS2013 Update 5 and get the latest nuget distro for VS2013 at
https://dist.nuget.org/visualstudio-2013-vsix/v2.12.0/NuGet.Tools.vsix
Once that was done, I rebooted Visual Studio. After that I was able to use the Automapper 5.0.2 package
Go to Visual Studio > Tools > Extension and Updates
Find Updates in left accordion menu, Go to Visual Studio Gallery.
You will find a update for Nuget.
Update the nuget package and try installing or builing the project.
Thanks,
GT
An other workaround if you're stuck with VS2012 and the old Nuget version:
Find the Cache folder of VS 2012's Nuget Package Manager (with Tools - Options - Nuget Package Manager)
Open AutoMapper.5.x.x.nupkg with your favorite Zip Tool
Modify the file AutoMapper.nuspec - I simply deleted all dependencies except .NETFramework4.5
Add the cache folder as a Nuget source (also in Tools - Options - Nuget Package Manager)
Install Automapper either with the console or the GUI but make sure to choose first the newly added cache folder as package source.
Of course, the next version of Automapper probably needs to be adapted, too, in order to install it.
This looks like a mismatch between the .NET version used by the Automapper package and your project. Can you confirm the .NET version that your project is using?
Automapper 6.0.2 - nuget 2.8.8 gives this error. Needed to update to 3.4.4 to get this working.
Removed both CSharp and AutoMapper. Installed CSharp (4.0.0.0) first and then added Automapper (6.1.1.0). This resolved the problem for me.
I observed this exact problem when opening a project with Visual Studio 2010.
After opening with VS2017, I was able to install AutoMapper without any error.