ASP.NET Core 2.2 -> 3.0 upgrade. env.IsDevelopment() not found
Solution 1:
The new IHostEnvironment
, IsDevelopment
, IsProduction
etc. extension methods are in the Microsoft.Extensions.Hosting
namespace which may need to be added to your app.
Reference:
https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#migrate-startupconfigure
https://github.com/aspnet/AspNetCore/issues/7749
Solution 2:
As Rena says IsDevelopment
has been moved to IHostEnvironment
Interface in the
Microsoft.Extensions.Hosting Namespace
I just had to add the
using Microsoft.Extensions.Hosting;
and then I could use IsDevelopment()
as before.