Upgrading from .net core 2.1 to .net 5.0 error 'IApplicationBuilder' does not contain a definition for 'UseDatabaseErrorPage' - .net-5

Can anyone recommend solution for below error getting when Upgrading from .net core 2.1 to .net 5.0 :
'IApplicationBuilder' does not contain a definition for 'UseDatabaseErrorPage' and no accessible extension method 'UseDatabaseErrorPage' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)
Microsoft Doc says its obsolete:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.databaseerrorpageextensions.usedatabaseerrorpage?view=aspnetcore-5.0
Below reference from microsoft page does not work on 5.0:
https://github.com/aspnet/Announcements/issues/432
Thanks,

Add NuGet package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
2. Add using statement Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
Add middleware app.UseDeveloperExceptionPage();

Related

Kendo for .net Core 3.1

I try to use Kendo in my Razor Pages app, I followed this doc https://docs.telerik.com/aspnet-core/getting-started/first-steps, but I have error:
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Kendo.Mvc.Rendering.IKendoHtmlGenerator Lifetime: Transient ImplementationType: Kendo.Mvc.Rendering.KendoHtmlGenerator': Could not load type 'Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)'
I'm using Telerik.UI.for.AspNet.Core, version 2019.1.220.
I'm going to add my comment as an answer, because this Telerik thread confirms (and references the same error you are encountering) that you'll need a later version of Kendo to have support for .NET Core 3.1.
This quote here from the thread linked above - about .NET Core 3.0 requiring a later version than you are using:
Artem, that is correct. Only the latest version of the UI for ASP.NET
Core suite (2019.3.1023) offers official support for .Net Core 3.0.
Jerry, feel free to contact us if you have any further questions on
the .Net Core 3.0 integration.
Regards, Veselin Tsvetanov
R3 2019 is the first release that mentions full support for .NET Core 3.1.

Supporting an .Net Framework Lib in .Net Core 2.0 WebAPI - Error

so basicly out complete company dataaccess is based in .Net Framework 4.6.
We are only on windows, so no problems here atm.
We have a new project in which I want to use .Net Core 2.0 and WebAPI but I have to use this "old" .net Framework lib.
When I add the reference and start my project I will get an error:
Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.'
As far as I googled it and understand, the dataasccess lib will try to get the win auth but this isnt available in .net core (obvious) any more.
I found the nuget Microsoft.Windows.Compatilibity and after installing the error is gone.
But another one comes up:
Exactly this error:https://community.oracle.com/thread/4139377
And the only solution to this seems to be to remove the MS.Win.Comp package...
So a bit of a circle.
Any ideas?

Error upgrading from .Net Core 1.0.0 to 1.1.0

I have a .NET Core project which I am getting back to which was working fine. I ran a NuGet update which upgraded a number of items, mainly going from AspNetCore 1.0.0 to 1.1.0. The solution compiles fine, but when I run it, I get this exception in the browser:
FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Adding Microsoft.AspNetCore.Http.Features in project.json does not fix the problem and I can find no reference to it. Does any one have a suggestion on resolving this?
I encountered the same problem after updating from 1.0.0 to 1.1.0 (ASP.NET Core Web Application (.NET Framework 4.6.2) x86) using Visual Studio Community 2017 RC.
My solution were to uninstall the Codegeneration design package:
Microsoft.VisualStudio.Web.Codegeneration.Design (1.0.0-msbuild1-final)
Update!
The faulty package has since been updated (1.0.0-msbuild2-final as of this writing). So instead of removing the package, tick "include prerelease" and update.
According to this site Announcing the Fastest ASP.NET Yet, ASP.NET Core 1.1 RTM the .NET Core 1.1 SDK needs to be installed. I assumed that I had already done that through a Visual Studio notification, but that wasn't the case. Once I installed it, the site worked.

Json.Net NuGet (NuPack) Package Reference unable to find assembly compatible with target framework

I am getting an error when trying to add the Json.net package reference through the NuGet / NuPack Add Package Reference Dialog. The error I get is:
Unable to find assembly references that are compatible with the target framework 'Silverlight,Version=4.0,Profile=WindowsPhone'
I have the latest version of both the Windows Phone 7 SDK and the Package Manager tools installed. This is running in Visual Studio 2010.
Has anyone else run into this error?
According to James Newton-King (author of Json.NET), you can use the Silverlight 3.0 version.
http://json.codeplex.com/Thread/View.aspx?ThreadId=226910
Unfortunately the NuGet package doesn't properly indicate Windows Phone 7 support. So you'll have to add the reference the old-fashioned way. (e.g. Copy the assembly into a directory such as ~\lib\Json.NET - where ~ is your solution root - and Project... Add Reference...)

system.diagnostics.contracts.contract exists in both v4.0 v3.5

I just upgraded to visual studio 2010 and installed the code contracts msi. When I try to use it I get a compiler error that the system.diagnostics.contracts.contract dll exists in both the v3.5 and v4 framework. Anyone know what I should do to resolve this? Thanks.
If you're upgrading a .NET 3.5 project that uses contracts to .NET 4.0, make sure you remove your reference to the Microsoft.Contracts assembly.
The Microsoft.Contracts assembly provides code contracts for use in .NET 2.0 or 3.5 projects, but is provided by default with .NET 4.0 in mscorlib, so you don't need it. They both share the System.Diagnostics.Contracts namespace, so by having references to both at the same time, the compiler isn't able to figure out which one you're trying to use.
I solved it by first installing it, thou that did not actually solve it.
Then removed the references and then I changed the project versions to 4.5 and after that, it worked.

Resources