Skip to content

Commit

Permalink
BasePath for Configuration files should be next to Assembly (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoscie authored Oct 9, 2024
1 parent 1ce058b commit 9c255bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/notify-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
notify:
runs-on: ubuntu-latest
steps:
- uses: neolution-ch/action-release-notifier@v1.3.0
- uses: neolution-ch/action-release-notifier@v1
with:
slack-token: ${{ secrets.SLACK_RELEASE_NOTIFIER_TOKEN }}
slack-channel-ids: ${{ vars.SLACK_CHANNEL_ID_RELEASE_ANNOUNCEMENTS }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Resolved an issue where appsettings.json was being loaded from the current working directory instead of the executable's directory.

## [3.0.2] - 2024-10-04

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions Neolution.DotNet.Console/DotNetConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ private static DotNetConsoleEnvironment CreateConsoleEnvironment(string[] args)
{
EnvironmentName = configuration[HostDefaults.EnvironmentKey] ?? "Production",
ApplicationName = AppDomain.CurrentDomain.FriendlyName,
ContentRootPath = Environment.CurrentDirectory,
ContentRootFileProvider = new PhysicalFileProvider(Environment.CurrentDirectory),
ContentRootPath = AppContext.BaseDirectory,
ContentRootFileProvider = new PhysicalFileProvider(AppContext.BaseDirectory),
};
}

Expand All @@ -205,7 +205,7 @@ private static DotNetConsoleEnvironment CreateConsoleEnvironment(string[] args)
private static IConfiguration ApplyDefaultConfiguration(Assembly assembly, string[] args, IHostEnvironment environment)
{
var configurationBuilder = new ConfigurationBuilder()
.SetBasePath(Environment.CurrentDirectory)
.SetBasePath(AppContext.BaseDirectory)
.AddEnvironmentVariables(prefix: "DOTNET_");

AddCommandLineConfig(configurationBuilder, args);
Expand Down

0 comments on commit 9c255bd

Please sign in to comment.