Description
I have a self-contained application without ".runtimeconfig.json" and without .deps.json.
I recently needed to start using ".runtimeconfig.json" (for the purpose of setting 'System.GC.Server').
The inclusion of the ".runtimeconfig.json" file changed the behavior of the (self-contained) application and now it can no longer be started when the current directory is the application directory.
I have to change the current directory in order for me to start the application.
After investigation, I have came across this in fx_muxer.cpp:
|
// Name of runtimeconfig file; since no path is included here the check is in the current working directory |
|
return (deps_exists || !pal::file_exists(config_in_cwd)) && pal::file_exists(host_info.app_path) ? host_mode_t::apphost : host_mode_t::split_fx; |
As can be seen, the presence of '{appname}.runtimeconfig.json' in the current directory, affect whether the self-contained application will be detected as a "standalone apphost" or "legacy split mode".
Reproduction Steps
- Create a Console application
- Set "GenerateRuntimeConfigurationFiles" and "GenerateDependencyFile" to false.
- Publish the application and set self-contained to true.
- Add a minimal {appname}.deps.json to the application directory containing just "{}".
- Attempt to launch the application when the current directory is the application directory.
Expected behavior
The application should launch successfully.
Actual behavior
The following message is displayed
Could not execute because the application was not found or a compatible .NET SDK
is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application '/RUNASAPPLICATION' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
Regression?
No
Known Workarounds
Change the working directory
Configuration
Tested .NET Core 3.1 / .NET 5 / .NET 6.0.1
Other information
No response
Description
I have a self-contained application without ".runtimeconfig.json" and without .deps.json.
I recently needed to start using ".runtimeconfig.json" (for the purpose of setting 'System.GC.Server').
The inclusion of the ".runtimeconfig.json" file changed the behavior of the (self-contained) application and now it can no longer be started when the current directory is the application directory.
I have to change the current directory in order for me to start the application.
After investigation, I have came across this in fx_muxer.cpp:
runtime/src/native/corehost/fxr/fx_muxer.cpp
Line 326 in bc6d349
runtime/src/native/corehost/fxr/fx_muxer.cpp
Line 329 in bc6d349
As can be seen, the presence of '{appname}.runtimeconfig.json' in the current directory, affect whether the self-contained application will be detected as a "standalone apphost" or "legacy split mode".
Reproduction Steps
Expected behavior
The application should launch successfully.
Actual behavior
The following message is displayed
Regression?
No
Known Workarounds
Change the working directory
Configuration
Tested .NET Core 3.1 / .NET 5 / .NET 6.0.1
Other information
No response