'IHostingEnvironment' is obsolete

前端 未结 2 1156
一整个雨季
一整个雨季 2020-12-29 17:33

I updated my ASP.NET Core project to .NET Core v3.0.0-preview3, and I now get:

Startup.cs(75,50,75,69): warning CS0618: \'IHostingEnvironment\' is o

2条回答
  •  星月不相逢
    2020-12-29 18:28

    It seems IHostingEnvironment has been replaced by IHostEnvironment (and a few others). You should be able to change the interface type in your code and everything will work as it used to :-)

    You can find more information about the changes at this link on GitHub https://github.com/aspnet/AspNetCore/issues/7749

    EDIT There is also an additional interface IWebHostEnvironment that can be used in ASP.NET Core applications. This is available in the Microsoft.AspNetCore.Hosting namespace.

提交回复
热议问题