Fix computation of app path when published as a "single file" #298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When publishing GCM as a 'single file' application, the computed path to the entry executable is no longer correct.
On .NET Core 3.1, using
Assembly.Location
resolves to the temporary extracted DLL file path. On .NET 5Assembly.Location
always returns the empty string.Since .NET 5, published single-file apps no longer use the self-extraction model, and are real single file with all assemblies and native libraries statically linked/bundled.
We now use the
Environment.GetCommandLineArgs()
method to get the raw underlying "argv" arguments, which argv[0] is the absolute file path to the entry executable.We also change how we get the application version number to look for the assembly attribute, rather than extract if from the file on disk.
At app startup, also change the way we trace system information to be more readable.
Fixes #229
Fixes #252