I created a console application using Jetbrains rider. I then published the console application to a folder. I added the folder to my System path. I can run echo %PATH%
and see that the folder is in the path however I can only run the console application if I am inside the folder. It doesn't event work if I put the full path to the executable.
C:\Program Files<Company Name><Program Name><files>
I also checked the files permissions against another file and that seems to be the same. I disabled a virus protection and that didn't fix the issue either.
Any thoughts on why this will not run? I am running windows 10.
Solution
Set the base path while creating the applications configuration.
builder
.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location)) // set the base path
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();