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:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top 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 >
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 Free
Top 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
I found that if I commented out this line in program.cs, the app loads ok: //Application.EnableVisualStyles();
Duplicate of #4397