I am currently upgrading a project from .NET Core RC1 to the new RTM 1.0 version. In RC1, there was a IApplicationEnvironment
which was replaced with IHostingEnvironment
in version 1.0
In RC1 I could do this
public class MyClass
{
protected static IApplicationEnvironment ApplicationEnvironment { get;private set; }
public MyClass()
{
ApplicationEnvironment = PlatformServices.Default.Application;
}
}
Does anyone know how to achieve this in v1.0?
public class MyClass
{
protected static IHostingEnvironment HostingEnvironment { get;private set; }
public MyClass()
{
HostingEnvironment = ???????????;
}
}
Using
Microsoft.Extensions.Hosting
(which is one of the included packages in ASP.NET Core), you can use: