Nuget "Older to New" Update Failed - nuget

I want to update project for Asp.NET Web Api 2.2 (My project is Web Api 1.0). But Nuget doesn't update all package and i didn't find this problem's solve.
Can you help me for this problem ?
Failed Text:
Updating 'Microsoft.AspNet.WebApi.Core 4.0.30506.0' to 'Microsoft.AspNet.WebApi.Core 5.2.0' failed. Unable to find a version of 'Strathweb.CacheOutput' that is compatible with 'Microsoft.AspNet.WebApi.Core 5.2.0'.

It looks like the current build of Strathweb.CacheOutput (0.5.0) package is fixed to WebApi 4.0.30506.
You have 2 options:
Contact the package owner and ask them to allow the package to work with newer versions of WebApi
Use the command line for NuGet in Visual Studio to force the package update by specifying the -IgnoreDependencies argument
Either way, you will need a binding redirect for Microsoft.AspNet.WebApi.Core 4.0.30506.0 -> 5.2.0, depending on which option you use, NuGet may add this to your web.config for you.

Related

Why can't I install Microsoft.EntityFrameworkCore.Sqlite?

I am following this tutorial:
https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=visual-studio
I am immediately stopped because I can not complete the following command:
Install-Package Microsoft.EntityFrameworkCore.Sqlite
This is the error:
Could not install package 'Microsoft.EntityFrameworkCore.Sqlite.Core 7.0.0'. You are trying to install a package into a project that targets '.NETFramework,Version=v4.7.2', 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.
I am attempting to learn how to use the Entity Framework and so I don't know much regarding this. Any advice would be helpful even if it's a link to something I need to read.
About the tutorial
The tutorial is about .netCore but in the error message you can see that you created a .netFramework project '.NETFramework,Version=v4.7.2'.
Create a new console application, but don't select projects that have (.NET Framework) in the description.
About the Sqlite package (only if continue the practicing with .netFramework)
The command Install-Package Microsoft.EntityFrameworkCore.Sqlite will try to install the last version. Currently, the last version is 7.0.0. This version only work with .NET 6.0.
You can check existing .net versions right here
So, you need to specify the version. The version for .NET 4.7.2 is the 3.1.31.
Install-Package Microsoft.EntityFrameworkCore.Sqlite -Version 3.1.31
Nuget Sqlite package info here

Nuget package is not compatible, but in the supported-list (StrawberryShake.Tools)

I got this message after creating a new .NET 5-project (in VS2019) and trying to install nuget-package StrawberryShake.Tools. This seems a bit strange, since it says both that it is and it isnt compatible with "net5.0 (.NETCoreApp,Version=v5.0)"
Error NU1202 Package StrawberryShake.Tools 12.6.0 is not compatible
with net5.0 (.NETCoreApp,Version=v5.0). Package StrawberryShake.Tools
12.6.0 supports:
net5.0 (.NETCoreApp,Version=v5.0) / any
net6.0 (.NETCoreApp,Version=v6.0) / any
netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any
I had the same problem, so I followed the official installation guide instead. The steps are as follows:
Open a terminal and navigate to e.g. the project where you want the package to be installed.
Run dotnet new tool-manifest.
Run dotnet tool install StrawberryShake.Tools --local. The nuget package has now been installed in ~/.nuget/packages and may be used in the project.

NU1102: Unable to find package Microsoft.Windows.SDK.BuildTools with version (>= 10.0.19041.8)

In my build pipeline, I have the following step:
I am getting the following error:
##[error]The nuget command failed with exit code(1) and error(NU1102: Unable to find package Microsoft.Windows.SDK.BuildTools with version (>= 10.0.19041.8)
When I go to the NuGet page for this package: Microsoft.Windows.SDK.BuildTools, I see that it only has one version: 10.0.18362.3-preview. I am not sure why the NuGet restore step is trying to get a higher version that does not exist. Why is this happening and how can I fix it? Note: this is my first Pipeline.
Agent Specification: Windows-2019.
From this page, you can see only two versions of the package Microsoft.Windows.SDK.BuildTools are listed:
10.0.19041.1
10.0.18362.3-preview
When open the page of version 10.0.19041.1, you can see the warning message to notify that this package version has been deprecated. But it seems that you can still download and install it.
I think the other package versions may have been permanently deleted by the owner due to some security vulnerabilities. So you no longer find them.
You can try to open your project using Visual Studio on your local machine, and change to use version 10.0.18362.3-preview in your program.

Dotnet restore not working

dotnet Version: 1.1.0 (global.json)
NuGet Version : 4.4.1.4656
VS2017 v15.5.2 (as Administrator)
.NET Core 1.1
The solution I am trying to build
Update I:
I just changed the project to run under target framework .NET Core v2.0 & sdk version 2.1.3 and I only get these kind of errors:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.Extensions.FileProviders.Physical 1.1.0
is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0).
Package Microsoft.Extensions.FileProviders.Physical 1.1.0 does not
support any target
frameworks. AspNetCoreExample C:\Users\Admin\Source\Repos\Examples\src\AspNetCoreExample\AspNetCoreExample.csproj 1
Update II:
While the following solves the current issue, i am not sure if it solves the root cause for this issue.
Delete the global nuget.config file %AppData%/Nuget/Nuget.config.
I fixed this issue by doing the following:
I migrated the project to .net core 2.0 and changed the global.json to point to sdk 2.1.3.
Removed all references in AspNetCoreExample manually and added the latest version for all of them.
Issues with target framework 1.1
When doing a restore from the solution in VS 2017:
When doing the restore from cmd (dotnet restore)
Running dotnet restore in Package Manager Console
NuGet.targets(103,5): error : Access to the path 'System.Runtime.dll'
is denied
.NET Core SDKs installed:
.NET Host
Now when opening the solution I get:
Comparing the log entries you pasted to their AppVeyor build,
https://ci.appveyor.com/project/Autofac/examples
Your machine's NuGet configuration seems to be broken. Analyze that and fix the issues.
You should add this code to your .csproj file
<RuntimeFramework>2.0.3</RuntimeFramework>
This worked for me.

Unable to resolve dependencies. 'xxx' is not compatible with 'yyy constraint: zzz)'

We have a project that is utilizing a set of Nuget-based Azure libraries. One of them was published with a specific MIN and MAX dependency on Newtonsoft.Json (max version being 7)
This was a headache, because other libraries depend on 8+ version of Netwon and this specific Azure library is just fine working with any modern Json package.
In VS2013, we forced to install this Azure library with newer version of Json package thru nuget installer and subsequently, Nuget never gave us any issues installing/updating other libraries.
However, after upgrading to VS2017, we cannot update any package (or at least the ones that depend on Json) and we get the error below.
Unable to resolve dependencies. 'Newtonsoft.Json 8.0.3' is not compatible with 'Microsoft.Azure.Insights 0.15.0-preview constraint: Newtonsoft.Json (>= 6.0.8 && < 7.0.0)'
How do we have Nuget ignore that specific Azure library's unimportant MAX version dependence?
How do we have Nuget ignore that specific Azure library's unimportant MAX version dependence?
If you confirm that Azure library is just fine working with any modern Json package and you want use the Microsoft.Azure.Insights 0.15.0-preview and 8+ version of Newtonsoft.Json at the same time. I would like provide a workaround to you, hope this can help you.
Detailed Steps:
Install the package Microsoft.Azure.Insights 0.15.0-preview with its dependencies first.
Only uninstall the package Microsoft.Azure.Insights 0.15.0-preview, Keep dependencies installed.
Update the Newtonsoft.Json to the version 8+.
Install the package Microsoft.Azure.Insights 0.15.0-preview in the Package Manager Console with following NuGet command:
Install-package Microsoft.Azure.Insights -IncludePrerelease -IgnoreDependencies
With the option -IgnoreDependencies, NuGet will ignore that specific Azure library's unimportant MAX version dependence:
Note: Need to mention is that if you update the Newtonsoft.Json package next time, you still need to follow the steps above to upgrade your Newtonsoft.Json package.