question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for .NET 5.0 single file applications

See original GitHub issue

I 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.

https://github.com/ElinamLLC/SharpVectors/blob/ff1bfec5774f7db6e1673c03deed2d003f22b546/Source/SharpVectorRenderingWpf/Utils/WpfSvgWindow.cs#L136

https://github.com/ElinamLLC/SharpVectors/blob/ff1bfec5774f7db6e1673c03deed2d003f22b546/Source/SharpVectorRenderingWpf/Utils/WpfSvgWindow.cs#L184

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
paulushubcommented, Sep 21, 2021

@MihailsKuzmins Yes, the issue considered resolved. It will be closed after a Nuget release.

1reaction
Dropperscommented, Aug 26, 2021

@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)

ManifestModule.Name: <Unknown>
ManifestModule.ScopeName: ConsoleApp3.dll
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found