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.

Some file is missing from single-file self-contained publish beginning in .NET 5.0.3

See original GitHub issue
  • .NET Core Version: 5.0.3
  • Have you experienced this same bug with .NET Framework?: No

Problem description:

Application fails to launch with this message: Launch exception: The system cannot find the file specified. (0x80070002) This only happens with a a single-file self-contained app published to a folder on a PC that doesn’t have .NET 5 runtime installed. If the app is published self-contained but not single-file, the app runs as expected.

This appears to only happen in a winforms app. I have not seen this behavior in WPF apps.

Expected behavior: It should run when published single-file self-contained as it did with previous versions of .NET 5, which did not have this issue,

Minimal repro:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gcaugheycommented, Feb 26, 2021

I found that if I commented out this line in program.cs, the app loads ok: //Application.EnableVisualStyles();

0reactions
RussKiecommented, Mar 1, 2021

Duplicate of #4397

Read more comments on GitHub >

github_iconTop Results From Across the Web

Self-Contained Single-File does not produce a single file
I have set it up to publish as a self-contained single-file. However, in the publish directory is the EXE file and four DLLs....
Read more >
roslyn - .NET 5 not compiling to single file executables
NET 5, to get a single runnable executable file when you publish your project, the important properties are: PublishSingleFile; SelfContained ...
Read more >
Publishing A Single EXE File In .NET Core 3.0
All this does is runs our publish command but tells it to package it within a single file. You'll notice that we no...
Read more >
How to publish .NET console app to single independent . ...
PublishSingleFile - Enables single-file publishing. SelfContained - Determines whether the app will be self-contained or framework-dependent. " ...
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 ... There are 11 files and a folder in...
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