.net core packages and dependency to the .net runtimes - .net-core

Assuming I'm already using the NuGet Package
Microsoft.AspNetCore.Components 5.0.3
Can I upgrade it to 5.0.5 without having the 5.0.5 runtime installed (dotnet --list-runtimes)?
If I look at the dependencies in Nuget it just states:
net5.0 (no specific sdk, nor runtime)
-> Microsoft.AspNetCore.Components.Analyzers (>= 5.0.5)
-> Microsoft.AspNetCore.Authorization (>= 5.0.5)

Is there a specific reason to upgrade to 5.0.5 from 5.0.3? If its because you need something specific added in 5.0.5, then, while it might work, chances are it wont, as Andy says

Related

Using a nuget package with a reference to a 2.2 shared framework package in 3.1

We are currently upgrading some of our applications from dotnet core 2.X to core 3.1 and I have come across an interesting conundrum. We have a shared nuget package which references Microsoft.AspNetCore.Http.Abstractions 2.2.0 and when we are building our new 3.1 version with docker and the 3.1 sdk we are getting errors about being unable to resolve the assembly reference.
I can fix this by adding an explicit reference to Microsoft.AspNetCore.Http.Abstractions 2.2.0 to the project but I am interested in the "correct" way approach this problem. It feels like there should be a way to have the package reference either assembly depending on what is installed on the host. Meaning our package can be shared between 2.1 and 3.1.
We could create a new package that references the 3.1 shared framework but then we would need some way to distinguish which package to use 2.2 or 3.1 - we would like to avoid pinning our package versions to dotnet core versions because we use our own semver numbering for the packages.
The crux of the question is - what is the best way to manage a package that has a dependency on a previous version of AspNetCore.App?
So this seems strange to me but the fix works. It turns out if I reference the Microsoft.AspNetCore.Http.Abstractions 2.0.2 dependency in my nuget package then any consumers of that package work both on 2.x projects and 3.x ones. It's like the core 3.x runtime understands how to deal with a 2.0.2 package but not a 2.1 or a 2.2 one!
I am sure there is a jolly good reason for this but im not clear on what that is!

Detected package downgrade for Boilerplate Application(.NET Core 3.1)

I'm trying to open my Boilerplate Application(.NET Core 3.1)in VSCode in Linux but below exception, keep appeared for me. Is there any difference between .NET Core for Linux and for Windows or What is the problem?
Detected package downgrade: Abp.ZeroCore from 5.7.0 to 5.1.0. Reference the package directly from the project to select a different version.
No this is not related to the OS that you run your application.
As stated in the error message there a downgrade in one of your nuget packages.
Go to your Boilerplate.csproj and try to manually set the version of Abp.ZeroCore nuget package from 5.1.0 that it is currently to 5.7.0.

Combine Microsoft nuget with lower dotnet core version

I have a dotnet core 2.1 lts docker image and I need to have a timestamp in the log. The Microsoft.Extensions.Logging preview for dotnet core 3.0 has this feature. Of course this package will not have long term support.
Can I combine a nuget package, which share the version of dotnet core, with a lower version of the dotnet core framework or does that result into in unsupported setup?
You didn't specify what your applications uses, so I need to write a somewhat generic answer.
The package Microsoft.Extensions.Logging targets netstandard 2.0, which means it will work on dotnet core 2.1
This issue you will have, is that it will force the dependencies it uses to upgrade too:
Microsoft.Extensions.Configuration.Binder (>= 3.0.0-preview4.19216.2)
Microsoft.Extensions.DependencyInjection (>= 3.0.0-preview4.19216.2)
Microsoft.Extensions.Logging.Abstractions (>= 3.0.0-preview4.19216.2)
Microsoft.Extensions.Options (>= 3.0.0-preview4.19216.2)
And those have dependencies too... in the end it might upgrade quite a lot of your project dependencies with packages which are in preview. (thus not supported)
I would not advice you to do this, but in the end it simply depends on what functionality you are using in your application. If only your code depends on the Microsoft.Extensions.Logging functionality you should be okay, although currently not supported. As soon as you use other packages which use one of the upgrade Microsoft.Extensions package the major version change should tell you that this might cause issues.

Unable to find a version of 'Newtonsoft.Json'

My current asp.net mvc app needs 11.0.2 version of 'Newtonsoft.Json'
However, I want to add a nuget package "UmbracoCMS" that needs Newtonsoft.Json (>= 10.0.2 && < 11.0.0)'
Please let me know how I could handle this in the web.config
I tried assemblyredirect but that didn't help. Thank you.
Unable to find a version of 'Newtonsoft.Json'
This issue is not related to assembly-redirect, so you could not resolve it by web.config. That is because the prerequisite for assembly-redirect is that different versions of the Newtonsoft.Json assembly should be all acceptable for your project and we use assembly-redirect to select one of the version to our project.
Check a sample link.
However, your current question is that you can not get both versions to work for your project. Your asp.net mvc app needs 11.0.2 version of Newtonsoft.Json, but the nuget package UmbracoCMS that needs Newtonsoft.Json (>= 10.0.2 && < 11.0.0). You can not use both versions, so you can not use assembly-redirect to select one of the version to your project.
To resolve this issue, you have to resolve the reference conflict. Could you only use Newtonsoft.Json 11.0.2 for your asp.net mvc app? Can you use Newtonsoft.Json 10.0.2/10.0.3 instead? If yes, you can install Newtonsoft.Json 10.0.2/10.0.3, then you can install the nuget package UmbracoCMS. If not, I am afraid you could not install the nuget package UmbracoCMS.
Hope this helps.

Newtonsoft version issue with .netcore and Azure

I have Solution like
ABC.Domain (.net standard 2.0)
ABC.Service (.net standard 2.0)
ABC.AzureFunction (.net standard 2.0) v2
ABC.Web (.net core 2.0)
Azure function SDK having a dependency on Newtonsoft 9.0.1 (not able to use upper version), So I used the same version on my ABC.Service project.
I using same ABC.Service reference into ABC.Web project. Now web application not allowing me to install Newtonsoft version 9.0.1.
I tried to uninstall all packages then install Newtonsoft version 9.0.1 first, but now I'm not able to install Microsoft.AspNetCore.All.
Detected package downgrade: Newtonsoft.Json from 10.0.1 to 9.0.1. Reference the package directly from the project to select a different version.
Any suggest??
The latest Microsoft.NET.Sdk.Functions package (version 1.0.13) for v2 depends on Newtonsoft.Json version 10.0.3.
Try changing all references to that version.

Resources