Onova: Not working with /p:PublishSingleFile=true apps
If 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
.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 54 (32 by maintainers)
Commits related to this issue
- Automatically handle .NET 5+ single executables Detecting when an application is published as a single executable by testing if the entry assembly `Location` is empty. Fixes #28 — committed to 0xced/Onova by 0xced a year ago
- Handle .NET 5+ single-file applications (#50) Co-authored-by: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Fixes https://github.com/Tyrrrz/Onova/issues/28 — committed to Tyrrrz/Onova by 0xced a year ago
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.
Update: the fix to the self-contained problem will come in the next .NET update:
https://github.com/dotnet/runtime/issues/13943#issuecomment-626191085