Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to fetch DNX_APPBASE after the RC1 update?

Been running a asp.net 5 console application that is published to multiple environments for a while now.

However, since the RC1 update, the environmental variable DNX_APPBASE that I relied on for the config.(environment).json location has been removed.

Here is the code in questionConsole Application

Anyone know what happened to the DNX_APPBASE environmental variable and where I can get this information from?

Alternatively, what are other ways to achieve the same result?

like image 866
Kyle Avatar asked Nov 24 '15 17:11

Kyle


1 Answers

you could add this into the constructor for Startup.cs

using Microsoft.Extensions.PlatformAbstractions;

public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
    // Setup configuration sources.
    var builder = new ConfigurationBuilder()
       .SetBasePath(appEnv.ApplicationBasePath)
       ....
}

but in RC1 it is not needed to call .SetBasePath at all, so you could remove that.

like image 180
Joe Audette Avatar answered Sep 20 '22 17:09

Joe Audette