Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App looks for appsettings.json in CWD instead of in location where exe is located #495

Open
Masamune3210 opened this issue May 15, 2024 · 7 comments

Comments

@Masamune3210
Copy link

What version are you using?
2.0.77.0
What OS are you running? (Btw, Typo here, Wat instead of What)
Windows 11
Are you using Docker or as a service?
No, manually launched through terminal
Which debrid provider are you using?
N/A
Which downloader are you using?
N/A
Please attach a log file here with the log setting set to debug
Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. The expected physical path was 'C:\Users\User\appsettings.json'. at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload) at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source) at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source) at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilder builder, String path, Boolean optional, Boolean reloadOnChange) at Program.<Main>$(String[] args) in C:\Projects\rdt-client\server\RdtClient.Web\Program.cs:line 20

@rogerfar
Copy link
Owner

That's pretty common if you haven't specified your working directory correctly. How are you starting the app?

@Masamune3210
Copy link
Author

by having the program directory in the system path and executing RdtClient.Web.exe from a terminal window

@rogerfar
Copy link
Owner

rogerfar commented Sep 3, 2024

I have never seen this behaviour yet, what .NET runtime are you using? And where is rdt-client extracted to?

And what command are you using to start the app?

@Masamune3210
Copy link
Author

Just the normal one that you would get from Microsoft, if you need any more verbosity on that point you will have to let me know how to give it

.\rdtclient.web.exe

@rogerfar
Copy link
Owner

rogerfar commented Sep 4, 2024

And just to be sure, the appsettings.json file is in the same folder right?

@Masamune3210
Copy link
Author

Yep, executing .\rdtclient.web.exe in the folder where the exe resides alongside its other files works fine, but just executing rdtclient.web.exe outside of the folder attempts to look for the json in the cwd instead of the directory the executable is in, saying

Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. The expected physical path was 'G:\Users\User\Downloads\appsettings.json'.
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilder builder, String path, Boolean optional, Boolean reloadOnChange)
at Program.

$(String[] args) in C:\Projects\rdt-client\server\RdtClient.Web\Program.cs:line 21

@Masamune3210
Copy link
Author

Masamune3210 commented Sep 4, 2024

Could it possibly be from this line? It seems to be adding the json but not specifying a directory before it, which if I'm not mistaken, causes it to look for the folder in the working directory

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants