You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BlazorWebView: Use AppContext.BaseDirectory instead of Environment.CurrentDirectory #21750
In BlazorWebView in WPF and WinForms code, we're using Environment.CurrentDirectory as the app root directory in the case when the location of the entry assembly is not known. This is the case when the app is published as a single file. We should use AppContext.BaseDirectory instead.
Run the app from a different folder. That is, say the app is in c:\myapp\cool_app.exe, then in a command prompt navigate to c:\other_folder and run c:\myapp\cool_app.exe
The original bug was caused by the 'current directory' to be different from where the app is, and due to the app being a single EXE, it couldn't find its own location to locate static assets, so content such as CSS wouldn't load. With the fix in #21797, the app can always locate its files (because the new API works even in single EXE apps), so all the app's content can be found.
Activity
PreciousNyasulu commentedon Apr 10, 2024
Assign it to me
fix: Use AppContext.BaseDirectory instead of Environment.CurrentDirec…
Eilon commentedon Apr 16, 2024
To repro the original problem:
c:\myapp\cool_app.exe, then in a command prompt navigate toc:\other_folderand runc:\myapp\cool_app.exeThe original bug was caused by the 'current directory' to be different from where the app is, and due to the app being a single EXE, it couldn't find its own location to locate static assets, so content such as CSS wouldn't load. With the fix in #21797, the app can always locate its files (because the new API works even in single EXE apps), so all the app's content can be found.
fix: Use AppContext.BaseDirectory instead of Environment.CurrentDirec…
[net8.0] Merge main to net8.0 (#22219)