I would like to have my application set the current working directory after my application is ran, meaning that, for example:
$ pwd
/my/directory
$ dotnet MyApp.dll
$ pwd
/another/place/somewhere
How can I do that in C# using .NET Core in a cross-platform way?
I looked at Environment.CurrentDirectory and Directory.SetCurrentDirectory but for both of them the working directory is reset to its original state when the application exits, as indicated in the documentation for Directory.SetCurrentDirectory.
When the application terminates, the working directory is restored to its original location (the directory where the process was started).
