How does ASPNET Core resolves the configuration pathHow to import a module given the full path?Publish not getting connection string from appsettings.production.jsonHow to store AWS credentials for dotnet core app hosted on Ubuntu 16.04?Dotnet isn't aware of environment specific appsettings fileWhat is the equivalent of Web.config transform in ASP.NET Core?Cannot find module 'aspnet-webpack' when using 'dotnet publish' in .Net Core 2.0 & AngularC# project configuration and environment variableDetailed application logs from aspnet core app to cloudwatchHow to have a config file for local development and one for the development server in AspNet Core without breaking the IsDevelopment function logicConfigure Asp.Net core web api Development environment during debugging with iis express

What does this Swiss black on yellow rectangular traffic sign with a symbol looking like a dart mean?

Why does std::string_view create a dangling view in a ternary expression?

Warnings using NDSolve on wave PDE. "Using maximum number of grid points" , "Warning: scaled local spatial error estimate"

Too early in the morning to have SODA?

Why does Linux list NVMe drives as /dev/nvme0 instead of /dev/sda?

How could empty set be unique if it could be vacuously false

Umlaut character order when sorting

How can I prevent a user from copying files on another hard drive?

King or Queen-Which piece is which?

Encounter design and XP thresholds

How much steel armor can you wear and still be able to swim?

Is there a name for the trope when there is a moments dialogue when someone pauses just before they leave the room?

What are the current battlegrounds for people’s “rights” in the UK?

Are there any individual aliens that have gained superpowers in the Marvel universe?

Why is it easier to balance a non-moving bike standing up than sitting down?

Explicit song lyrics checker

What does it cost to buy a tavern?

Should I include an appendix for inessential, yet related worldbuilding to my story?

Very tricky nonogram - where to go next?

Is the continuity test limit resistance of a multimeter standard?

Prisoner on alien planet escapes by making up a story about ghost companions and wins the war

Justifying Affordable Bespoke Spaceships

What was the first third-party commercial application for MS-DOS?

How hard is it to distinguish if I am given remote access to a virtual machine vs a piece of hardware?



How does ASPNET Core resolves the configuration path


How to import a module given the full path?Publish not getting connection string from appsettings.production.jsonHow to store AWS credentials for dotnet core app hosted on Ubuntu 16.04?Dotnet isn't aware of environment specific appsettings fileWhat is the equivalent of Web.config transform in ASP.NET Core?Cannot find module 'aspnet-webpack' when using 'dotnet publish' in .Net Core 2.0 & AngularC# project configuration and environment variableDetailed application logs from aspnet core app to cloudwatchHow to have a config file for local development and one for the development server in AspNet Core without breaking the IsDevelopment function logicConfigure Asp.Net core web api Development environment during debugging with iis express






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have the following code:



 var config = new ConfigurationBuilder();

config
.SetBasePath(Directory.GetCurrentDirectory())
.AddEnvironmentVariables()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.environment.json", true);


Which works fine in development environment and production too. However if I place this:



 Raise<FileNotFoundException>.If(File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json")),
$"Could not find the settings file");


It raises exception during debug sessions and release sessions (basically when the app is not published and executed from Visual Studio) that file could not be found which is kind of correct because VS2017 does not copy settings file to the debug folder and instead keep them in the source folder. So my question is,
how does the dotnet core resolves the configuration path for aspnet core?










share|improve this question






















  • Not 100% sure but probably using the IHostingEnvironment Interface the ContentRootPath property

    – Anton Toshik
    Mar 25 at 8:07

















0















I have the following code:



 var config = new ConfigurationBuilder();

config
.SetBasePath(Directory.GetCurrentDirectory())
.AddEnvironmentVariables()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.environment.json", true);


Which works fine in development environment and production too. However if I place this:



 Raise<FileNotFoundException>.If(File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json")),
$"Could not find the settings file");


It raises exception during debug sessions and release sessions (basically when the app is not published and executed from Visual Studio) that file could not be found which is kind of correct because VS2017 does not copy settings file to the debug folder and instead keep them in the source folder. So my question is,
how does the dotnet core resolves the configuration path for aspnet core?










share|improve this question






















  • Not 100% sure but probably using the IHostingEnvironment Interface the ContentRootPath property

    – Anton Toshik
    Mar 25 at 8:07













0












0








0


0






I have the following code:



 var config = new ConfigurationBuilder();

config
.SetBasePath(Directory.GetCurrentDirectory())
.AddEnvironmentVariables()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.environment.json", true);


Which works fine in development environment and production too. However if I place this:



 Raise<FileNotFoundException>.If(File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json")),
$"Could not find the settings file");


It raises exception during debug sessions and release sessions (basically when the app is not published and executed from Visual Studio) that file could not be found which is kind of correct because VS2017 does not copy settings file to the debug folder and instead keep them in the source folder. So my question is,
how does the dotnet core resolves the configuration path for aspnet core?










share|improve this question














I have the following code:



 var config = new ConfigurationBuilder();

config
.SetBasePath(Directory.GetCurrentDirectory())
.AddEnvironmentVariables()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.environment.json", true);


Which works fine in development environment and production too. However if I place this:



 Raise<FileNotFoundException>.If(File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json")),
$"Could not find the settings file");


It raises exception during debug sessions and release sessions (basically when the app is not published and executed from Visual Studio) that file could not be found which is kind of correct because VS2017 does not copy settings file to the debug folder and instead keep them in the source folder. So my question is,
how does the dotnet core resolves the configuration path for aspnet core?







asp.net-core configuration






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 6:56









Simple FellowSimple Fellow

2,69911725




2,69911725












  • Not 100% sure but probably using the IHostingEnvironment Interface the ContentRootPath property

    – Anton Toshik
    Mar 25 at 8:07

















  • Not 100% sure but probably using the IHostingEnvironment Interface the ContentRootPath property

    – Anton Toshik
    Mar 25 at 8:07
















Not 100% sure but probably using the IHostingEnvironment Interface the ContentRootPath property

– Anton Toshik
Mar 25 at 8:07





Not 100% sure but probably using the IHostingEnvironment Interface the ContentRootPath property

– Anton Toshik
Mar 25 at 8:07












1 Answer
1






active

oldest

votes


















0














I think you're getting confused on things here. The configuration is pulled by default from the entry point directory. Inside Visual Studio or when running dotnet run from the command-line within your project root, everything works fine. Also, when you publish, the published directory will contain the configuration files alongside the entrypoint DLL, so this will work fine as well.



What you seem to be talking about is running from the bin directory, which is not a supported thing. The bin directory is effectively a cache. It's not a published version of your application, and thus cannot be run as if it is.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332597%2fhow-does-aspnet-core-resolves-the-configuration-path%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I think you're getting confused on things here. The configuration is pulled by default from the entry point directory. Inside Visual Studio or when running dotnet run from the command-line within your project root, everything works fine. Also, when you publish, the published directory will contain the configuration files alongside the entrypoint DLL, so this will work fine as well.



    What you seem to be talking about is running from the bin directory, which is not a supported thing. The bin directory is effectively a cache. It's not a published version of your application, and thus cannot be run as if it is.






    share|improve this answer



























      0














      I think you're getting confused on things here. The configuration is pulled by default from the entry point directory. Inside Visual Studio or when running dotnet run from the command-line within your project root, everything works fine. Also, when you publish, the published directory will contain the configuration files alongside the entrypoint DLL, so this will work fine as well.



      What you seem to be talking about is running from the bin directory, which is not a supported thing. The bin directory is effectively a cache. It's not a published version of your application, and thus cannot be run as if it is.






      share|improve this answer

























        0












        0








        0







        I think you're getting confused on things here. The configuration is pulled by default from the entry point directory. Inside Visual Studio or when running dotnet run from the command-line within your project root, everything works fine. Also, when you publish, the published directory will contain the configuration files alongside the entrypoint DLL, so this will work fine as well.



        What you seem to be talking about is running from the bin directory, which is not a supported thing. The bin directory is effectively a cache. It's not a published version of your application, and thus cannot be run as if it is.






        share|improve this answer













        I think you're getting confused on things here. The configuration is pulled by default from the entry point directory. Inside Visual Studio or when running dotnet run from the command-line within your project root, everything works fine. Also, when you publish, the published directory will contain the configuration files alongside the entrypoint DLL, so this will work fine as well.



        What you seem to be talking about is running from the bin directory, which is not a supported thing. The bin directory is effectively a cache. It's not a published version of your application, and thus cannot be run as if it is.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 16:33









        Chris PrattChris Pratt

        165k22254320




        165k22254320





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332597%2fhow-does-aspnet-core-resolves-the-configuration-path%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현