Thursday, 5 December 2019

How to to use IHostingEnvironment in .net core class library?

Normally IHostingEnvironment will not be available in the class library. But its available in the Nuget as a package .

IHostingEnvironment  is part of Microsoft.AspNetCore.Hosting.Abstractions.dll

Install IHostingEnvironment  from Nuget package

Install-Package Microsoft.AspNetCore.Hosting

Then we are free to use the IHostingEnvironment  in class libraries also.

This API is now obsolete.
This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.AspNetCore.Hosting.IWebHostEnvironment.

No comments:

Post a Comment