Skip to content

Commit

Permalink
let user know working directory will be used as content root path by …
Browse files Browse the repository at this point in the history
…default (#82445)
  • Loading branch information
pedrobsaila authored Apr 26, 2023
1 parent ff0f603 commit c958573
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.IO;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -79,6 +80,13 @@ private void OnApplicationStarted()
Logger.LogInformation("Application started. Press Ctrl+C to shut down.");
Logger.LogInformation("Hosting environment: {EnvName}", Environment.EnvironmentName);
Logger.LogInformation("Content root path: {ContentRoot}", Environment.ContentRootPath);
string contentRootFullPath = Path.GetFullPath(Environment.ContentRootPath);

if (contentRootFullPath.Equals(System.Environment.CurrentDirectory, StringComparison.Ordinal)
|| contentRootFullPath.Equals(AppContext.BaseDirectory, StringComparison.Ordinal))
{
Logger.LogInformation("Current working directory is /. If Content root path is not set explicitly, then working directory is used by default.");
}
}

private void OnApplicationStopping()
Expand Down

0 comments on commit c958573

Please sign in to comment.