HttpRuntime.AppDomainAppPath equivalent in ASP.NET Core

前端 未结 1 1093
梦谈多话
梦谈多话 2021-01-06 01:53

What is the equivalent of HttpRuntime.AppDomainAppPath in .NET Core? I moved a project from ASP.NET to core, and a few Libraries are not included (Such as

相关标签:
1条回答
  • 2021-01-06 02:36

    The IHostingEnvironment interface provides information about the environment including the base path (documentation). You can get an instance using dependency injection.

    public class Startup
    {
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            // env.ContentRootPath;
        }
    }
    
    0 讨论(0)
提交回复
热议问题