mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
More aggressively retry when creating stub executables, and do not stop the release if this fails.
This commit is contained in:
@@ -247,8 +247,7 @@ namespace SquirrelCli
|
||||
.Where(x => !x.Name.Contains("squirrel.exe", StringComparison.InvariantCultureIgnoreCase))
|
||||
.Where(x => Utility.IsFileTopLevelInPackage(x.FullName, pkgPath))
|
||||
.Where(x => Utility.ExecutableUsesWin32Subsystem(x.FullName))
|
||||
.ForEachAsync(x => createExecutableStubForExe(x.FullName))
|
||||
.Wait();
|
||||
.ForEach(x => createExecutableStubForExe(x.FullName));
|
||||
|
||||
// sign all exe's in this package
|
||||
new DirectoryInfo(pkgPath).GetAllFilesRecursively()
|
||||
@@ -376,17 +375,23 @@ namespace SquirrelCli
|
||||
}
|
||||
}
|
||||
|
||||
static async Task createExecutableStubForExe(string exeToCopy)
|
||||
static void createExecutableStubForExe(string exeToCopy)
|
||||
{
|
||||
try {
|
||||
var target = Path.Combine(
|
||||
Path.GetDirectoryName(exeToCopy),
|
||||
Path.GetFileNameWithoutExtension(exeToCopy) + "_ExecutionStub.exe");
|
||||
|
||||
await Utility.CopyToAsync(HelperExe.StubExecutablePath, target);
|
||||
Utility.Retry(() => File.Copy(HelperExe.StubExecutablePath, target, true));
|
||||
|
||||
Utility.Retry(() => {
|
||||
using var writer = new Microsoft.NET.HostModel.ResourceUpdater(target, true);
|
||||
writer.AddResourcesFromPEImage(exeToCopy);
|
||||
writer.Update();
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
Log.ErrorException($"Error creating StubExecutable and copying resources for '{exeToCopy}'. This stub may or may not work properly.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user