Starting console application project resource does not honor workingDirectory
option of the launch profile
#304
Labels
bug
Something isn't working
Describe the bug
Starting an AppHost that has a reference to the console application ends up with the console application's current working directory be in the
bin/Debug/netX
folder even if the optionworkingDirectory
of the launch profile points to the folder containing the project file. As a result, correspondingappsettings.json
file is not found and proper configuration is not loaded.This is not the case for the Web applications, their
ContentRoot
is properly set to the folder, containing the project file. Starting the AppHost from the command line works as expected, and the CWD of the console application is set to the one, specified in the launch profile. Starting the ConsoleApplication from Rider as a configured .Net Launch Settings Profile entry also honor theworkingDirectory
option.To Reproduce
Steps to reproduce the behavior:
WebApplication
andConsoleApplication
.Console.WriteLine(Environment.CurrentDirectory);
to the top of bothProgram.cs
files.Properties/launchSettings.json
file with the following content:IDistributedApplicationBuilder
.WebApplication.csproj
file (.../WebApplication
) while Console application prints the path of the built executable (.../ConsoleApplication/bin/Debug/net9
) ignoring theworkingDirectory
option of the launch profile.Expected behavior
Web application should print to the console the path to the folder, containing
WebApplication.csproj
file, for example.../WebApplication
. Console application should print to the console the path to the folder, containingConsoleApplication.csproj
file, for example.../ConsoleApplication
.System information:
The text was updated successfully, but these errors were encountered: