Have a WPF .NET Core 3.1 app, and it was working on a computer for a while, then it would stop opening. Looking at the event viewer saw this error:
Description: A .NET Core application failed. Application: MyApp.exe Path: C:\Folder\MayApp.exe Message: The application to execute does not exist: 'C:\Users\user\AppData\Local\Temp.net\MyApp\002t0akn.2dd\MyApp.dll'.
If you delete the folder and start the app again it works. Any idea why?
The app is published, .netcoreapp3.1, self-contained, win-86, produce a single file and ready to run
The NET Core "single file" mechanism is a lot like the self-extracting ZIP executables of old; it makes it easier to distribute, but it still needs to dump all of the dependent files out somewhere before it can run, and it looks like the specific temp folder may be giving you issues.
The process is described in Microsoft's documentation:
Extraction Location
For a single-file app, the extraction directory is
<base>/<app>/<bundle-id>
<base>
is
DOTNET_BUNDLE_EXTRACT_BASE_DIR
environment variable, if set.- If not, defaults to:
- Windows:
%TEMP%\.net
<app>
is the name of the single-exe binary
<bundle-id>
is a unique Bundle-identifier.
You might try either disabling the single-file packaging or adjusting the environment variable to use a less transient folder for extraction.