Skip to content

Commit 9c255bd

Browse files
authored
BasePath for Configuration files should be next to Assembly (#17)
1 parent 1ce058b commit 9c255bd

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/notify-slack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
notify:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: neolution-ch/action-release-notifier@v1.3.0
11+
- uses: neolution-ch/action-release-notifier@v1
1212
with:
1313
slack-token: ${{ secrets.SLACK_RELEASE_NOTIFIER_TOKEN }}
1414
slack-channel-ids: ${{ vars.SLACK_CHANNEL_ID_RELEASE_ANNOUNCEMENTS }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Resolved an issue where appsettings.json was being loaded from the current working directory instead of the executable's directory.
13+
1014
## [3.0.2] - 2024-10-04
1115

1216
### Fixed

Neolution.DotNet.Console/DotNetConsole.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ private static DotNetConsoleEnvironment CreateConsoleEnvironment(string[] args)
190190
{
191191
EnvironmentName = configuration[HostDefaults.EnvironmentKey] ?? "Production",
192192
ApplicationName = AppDomain.CurrentDomain.FriendlyName,
193-
ContentRootPath = Environment.CurrentDirectory,
194-
ContentRootFileProvider = new PhysicalFileProvider(Environment.CurrentDirectory),
193+
ContentRootPath = AppContext.BaseDirectory,
194+
ContentRootFileProvider = new PhysicalFileProvider(AppContext.BaseDirectory),
195195
};
196196
}
197197

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

211211
AddCommandLineConfig(configurationBuilder, args);

0 commit comments

Comments
 (0)