Support for .NET 5.0 single file applications
See original GitHub issueI tried to publish my application, but unfortunately Assembly.GetExecutingAssembly().Location
will return an empty string for .NET 5.0 single file applications.
As per the documentation: “In .NET 5.0 and later versions, for bundled assemblies, the value returned is an empty string.”
I think the solution is to use Process.GetCurrentProcess().MainModule.FileName
or AppContext.BaseDirectory
, but the latter is only supported on .NET Core projects.
Issue Analytics
- State:
- Created 2 years ago
- Comments:24 (11 by maintainers)
Top Results From Across the Web
Create a single file for application deployment - .NET
Specifying IncludeAllContentForSelfExtract extracts all files, including the managed assemblies, before running the executable. This may be ...
Read more >roslyn - .NET 5 not compiling to single file executables
I'm having an issue regarding trying to compile my .NET 5 application to a single file executable while debugging through Visual Studio. My...
Read more >Support Single-File Apps in .NET 5 · Issue #36590
The .Net 5.0 single file solution should be: Widely compatible: Apps containing IL assemblies, ready-to-run assemblies, composite assemblies, ...
Read more >Publish single executable not working for .NET 5 or .NET 6
Solved: Publishing a WPF application as a single executable does not work for .NET 5 (using ArcGIS Runtime 100.12) or .NET 6 (using...
Read more >Publishing a self-contained single-file .NET 5 executable
A self-contained .NET application is one that doesn't rely on there being any shared components on the target machine (such as the .NET...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MihailsKuzmins Yes, the issue considered resolved. It will be closed after a Nuget release.
@MihailsKuzmins I tested it for a single file application and ScopeName does appear to work. Note that this is not the name of the executable (ConsoleApp3.exe) but the name of the extracted assembly which is invoked by the executable. (Single file application is like a zip file that is extracted on runtime)