Not working with /p:PublishSingleFile=true apps
See original GitHub issueIf a project is built as a single file:
dotnet publish -c Release -r win-x86 /p:PublishSingleFile=true
zip -j $zip_file ./bin/Release/netcoreapp3.1/win-x86/publish/myapp.exe
then the app is not updated with this code:
using (var manager = new UpdateManager(
new WebPackageResolver(Config.update_manifest_url),
new ZipPackageExtractor()))
{
var result = await manager.CheckForUpdatesAsync();
if (result.CanUpdate)
{
// Prepare an update by downloading and extracting the package
// (supports progress reporting and cancellation)
await manager.PrepareUpdateAsync(result.LastVersion);
// Launch an executable that will apply the update
// (can be instructed to restart the application afterwards)
manager.LaunchUpdater(result.LastVersion);
// Terminate the running application so that the updater can overwrite files
Environment.Exit(0);
}
}
It correctly detects the new version, downloads it, runs LaunchUpdater, but the actual file is not replaced with the new version. It works fine without /p:PublishSingleFile=true
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:54 (32 by maintainers)
Top Results From Across the Web
PublishSingleFile does not produce a single executable
I have a .Net Core 3 console application that i'm trying to publish as a self contained single executable. I've been able to...
Read more >dotnet/maui - publish failed with PublishSingleFile=true
I created a app by using the default template and test if it can be packaged as a SingleFile by using PublishSingleFile=true. But...
Read more >Self-Contained Single-File does not produce a single file
I have a small .Net 5 console application with no dependencies on third party components. I have set it up to publish as...
Read more >Create a single file for application deployment - .NET
Publish a single file application using the dotnet publish command. Add <PublishSingleFile>true</PublishSingleFile> to your project file. This ...
Read more >Single File Apps In .NET 6 - NET Core Tutorials
The main issues were : The single file exe was actually a self extracting zip that unzipped to a temp location and then...
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
https://github.com/levitatejay/self-contained-update-stuck
Steps to reproduce:
The SelfContainedUpdate.exe closes itself and if you try to delete it says its in use by Onova The Onova process never closes
I think it is getting stuck here: https://github.com/Tyrrrz/Onova/blob/master/Onova.Updater/Updater.cs#L39
I need to see why the Updater doesn’t have Write Access even though the exe not running anymore
@Tyrrrz I ran into this problem on my project and
solved it for me. I backported the fix to an older version (by removing a couple of tags locally) and the update replaced the file - which it did not do before. Project can be found at https://github.com/ipocsmr/ipocs.dpt The fix will be included in version 4.0.2 onwards to see if it works when it hits the wild.