C
C#12mo ago
enusbaum

Directory.GetCurrentDirectory() (PWD) on a Self-Contained Application

I'm working on an Open Source application that we distribute executable files for targeting multiple platforms. We use dotnet publish to generate our final Release artifacts and include the command line parameters --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:IncludeNativeLibrariesInSingleFile=true when generating the final executable so our final Release artifact is just the EXE and the appsettings.json file. What we've noticed that while the application is running in its published form, Directory.GetCurrentDirectory() returns the temporary folder the executable was extracted to and not the folder that actually contains the EXE file. Is there a way to always get the path of the actual EXE file at runtime and not the temporary folder the Single-File contents were extracted to?? Thanks in advance!!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server