Imageresizer and PrettyGifs in asp.net core - asp.net-core

In previous versions of ASP.NET Core we used PrettyGifs plugin. In order to make it working we had to add in Web.config. But in asp.net core we don't have web.config anymore. So how can we use this plugin?

All plugins also offer code-based configuration/installation, like new PrettyGifs().Install(Config.Current);
That said, ImageResizer 4.X requires .NET Full for the moment. Imageflow will support .Net Core and is cross-platform.

Related

ASP.NET Core Web Application with .NET Framework, I want to switch the target to .NET Core

I'm trying to change ASP.NET Core web application with .NET Framework as a target framework to use .NET Core 3.1.X
I try changing the target framework in the project file (.csproj), I encounter dependency issues, dependency conflict....
Is there any straightforward method to solve this issue?
Before you start your migration, you should know there’s several difference between .net framework and .net core, so please follow the official document to do some Pre-Migration steps.
Then you can follow this official document to migrate your application from framework to .net core 3.1.
Since your ideal .net core version is 3.1, still I suggest you can try to use .net 6. Also, you can use this upgrade tool to reach your goal. In fact, using this upgrade assistant is a batter choice than you doing it by yourself. Even if you are insisting using .net core 3.1, you can use this assistant to upgrade your version to 6 first then change it to 3.1.
Note:
Before you start your migration, please make a backup of your original project. That's because some packages in .net framework may be no longer available in .net core. So if there're some errors occur, you can go back to the original one.

Helper library for ASP.NET Core 5 - NuGet packages not available?

I'm writing a helper library for ASP.NET Core 5 (with .NET 5) and I need some APIs from the package Microsoft.AspNetCore.Server.Kestrel.Core. However, the package is only available in version 2.2 - not version 5.
Is ASP.NET Core no longer distributed via NuGet? And if so, how does one get the APIs with ASP.NET Core 5.
Side note: I found that I could use Microsoft.NET.Sdk.Web as SDK for the project but I'm unsure whether this is a valid/good/correct approach when writing a library.
Is ASP.NET Core no longer distributed via NuGet? And if so, how does one get the APIs with ASP.NET Core 5.
That's correct. The core of ASP.NET Core (no pun intended...) ships with .NET Core >= 3.0 as a shared framework. You can add a single FrameworkReference to your nuget package to pull this in. See https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-5.0&tabs=visual-studio#migrate-libraries-via-multi-targeting for more information.
Some background can be found here https://github.com/dotnet/aspnetcore/issues/3756

It's very confusing.. I was creating .net core web application and can see .NetFramework with .NetCore support

I was creating .net core web application and can see .NetFramework with .NetCore support. But I didn't choose .Net Standard. I don't understand. Please see the image asp.net core web application
This is Microsoft naming at work here. 😁 There are two dotnet frameworks: the "full" framework, which you selected, and the dotnet core framework.
Before dotnet core and all it's optimized, multiplatform goodness, there was the dotnet framework (refered to as the legacy or full framework). This is the predecessor of dotnet core. This full framework runs only on Windows and the computer it runs on needs the dotnet framework runtime.
Do not worry, the "full" in full framework comes from the transition period between the old dotnet framework and dotnet core. When dotnet core was version 1.0, it did not have all the functionality of today. So some developers called it the full framework (which had everything you needed to run your application) and the newer dotnet core framework which had only the basics.
You can see if you are running the legacy framework if there is the <TargetFramework>netXXX</TargetFramework> present in your solution/project file. The lastest version of the full dotnet framework is 4.8 (net48).
After that it switched to dotnet core 1.0 - 3.1. I'm not entirely sure how that's referenced in the solution/project files.
As a last remark, Microsoft had a great naming idea: the next version of dotnet core is named dotnet 5. They want to get back to the original name with this next version. Do keep in mind that you cannot easily upgrade from dotnet 4.X to dotnet 5. The day to day code looks very much alike, but the underlying engine is completely rewritten.
As far as I know, before .net core 3.0, asp.net core is support on .net framework. This is the reason why you could create .net core 2.1 on the .net framework.
But after 3.0, asp.net core not support .net framework. You could only create it on .net core framework.
More details, you could refer to this article and this github issue.

It's correct reference .NET Core from .NET Framework project?

I have an ASP NET MVC project with net471 target framework but I found nuget reference to Microsoft.AspNetCore.* or Microsoft.EntityFrameworkCore.*
It's correct? What problems can it entail?
It depends. First, I'm not sure if you're using terminology correct. Do you have an ASP.NET MVC 5 project or an ASP.NET Core project? If the former, then yes, it's very much incorrect. If the latter, then no it's fine, depending on the ASP.NET Core version.
.NET Framework 4.7.1 implements .NET Standard 2.0, which .NET Core 2.2 is also compatible with. Therefore, you can include ASP.NET Core 2.2 packages in a .NET Framework 4.7.1 project. Despite the name, an ASP.NET Core web app doesn't have to actually run on .NET Core. However, ASP.NET Core 3.0 or EF Core 3.0 would not work because those depend on .NET Standard 2.1, which no version of .NET Framework implements (and probably never will).

How can I connect to a SignalR hub using ASP.NET Core 2.1

I am trying to connect to SignalR hubs from an ASP.NET Core 2.1 project.
Looking at the documentation here: https://learn.microsoft.com/en-us/aspnet/core/signalr/dotnet-client?view=aspnetcore-2.2, it says a package reference to Microsoft.AspNetCore.SignalR.Client is required.
Looking at the NuGet site (https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/) for this library, no versions for .NET Core 2.X are available.
How come there are no versions for 2.1 available? What library can I use for connecting to SignalR hubs using .NET Core 2.1, if not Microsoft.AspNetCore.SignalR.Client?
The SignalR version numbers are a bit confusing because SignalR was actually not available with ASP.NET Core 1.x but came later with 2.x. And it shipped on a separate lifecycle which you can also see by the versions of the Microsoft.AspNetCore.SignalR package. So basically, the numbers are just very out of sync with ASP.NET Core versions.
They are fixing that in ASP.NET Core 3, where SignalR and its clients will be regular parts of ASP.NET Core, shipping normally with the framework and sharing version numbers.
For 2.x this basically means that you just pick the latest SignalR 1.x. To verify the best version, you should also look at the dependencies of Microsoft.AspNetCore.SignalR.Core which is the base dependency for both the client as well as the server package. You will see that it also depends on Microsoft.AspNetCore.Authorization. So that should be your indicator which version to use for which version of ASP.NET Core.
To summarize:
For ASP.NET Core 2.1, use version 1.0.4 of the server package and the client package.
For ASP.NET Core 2.2, use version 1.1.0 of the server package and the client package.
For ASP.NET Core 3.0, the server part already ships with ASP.NET Core and for the client use a 3.0 version.
Actually, you will not face any issue using the latest SignalR stable package (#aspnet/signalr#1) with .net core 2.1. Please see the related doc for more info.