On windows we distribute our application as a single file executable. We have been doing this since dotnet core 3.1 and we had a lot of issues when doing this since the file actually was extracted to a temp folder which caused all kinds of trouble.
In dotnet core 5 the documentation says
Bundling all application-dependent files into a single binary provides an application developer with the attractive option to deploy and distribute the application as a single file. This deployment model has been available since .NET Core 3.0 and has been enhanced in .NET 5.0. Previously in .NET Core 3.0, when a user runs your single-file app, .NET Core host first extracts all files to a temporary directory before running the application. .NET 5.0 improves this experience by directly running the code without the need to extract the files from the app.
This is not true... I am running our application on a win2019 server (clean install), and when I run the application I get temporary folder under C:\Windows\Temp\.net\<MyApplication>\<random-folder-name>.
This is actually even worse than the behavior in 3.1 since we in 3.1 could use DOTNET_BUNDLE_EXTRACT_BASE_DIR to target a custom dir. In dotnet 5 using DOTNET_BUNDLE_EXTRACT_BASE_DIR will use another folder but always add an extra folder with a custom name (in my latest test dvay3ibe.r5m ).
Description
On windows we distribute our application as a single file executable. We have been doing this since dotnet core 3.1 and we had a lot of issues when doing this since the file actually was extracted to a temp folder which caused all kinds of trouble.
In dotnet core 5 the documentation says
This is not true... I am running our application on a win2019 server (clean install), and when I run the application I get temporary folder under
C:\Windows\Temp\.net\<MyApplication>\<random-folder-name>
.This is actually even worse than the behavior in 3.1 since we in 3.1 could use
DOTNET_BUNDLE_EXTRACT_BASE_DIR
to target a custom dir. In dotnet 5 usingDOTNET_BUNDLE_EXTRACT_BASE_DIR
will use another folder but always add an extra folder with a custom name (in my latest testdvay3ibe.r5m
).Publish
This is how our application is published
dotnet publish ../src/WindowsService/ -c release -r win-x64 /p:PublishSingleFile=true -o ./
dotnet --info