diff --git a/build.ps1 b/build.ps1 index 7dfc8352..cd77d062 100644 --- a/build.ps1 +++ b/build.ps1 @@ -41,6 +41,7 @@ Copy-Item -Path "$PSScriptRoot\vendor\7zip\*" -Destination "$Out" -Recurse Copy-Item "$PSScriptRoot\vendor\NuGet.exe" -Destination "$Out" Copy-Item "$PSScriptRoot\vendor\rcedit.exe" -Destination "$Out" Copy-Item "$PSScriptRoot\vendor\signtool.exe" -Destination "$Out" +Copy-Item "$PSScriptRoot\vendor\singlefilehost.exe" -Destination "$Out" Remove-Item "$Out\*.pdb" diff --git a/src/SquirrelCli/HelperExe.cs b/src/SquirrelCli/HelperExe.cs index 4b9709d2..2d4a22e6 100644 --- a/src/SquirrelCli/HelperExe.cs +++ b/src/SquirrelCli/HelperExe.cs @@ -17,6 +17,7 @@ namespace SquirrelCli public static string SetupPath => FindHelperExecutable("Setup.exe", _searchPaths); public static string UpdatePath => FindHelperExecutable("Update.exe", _searchPaths); public static string StubExecutablePath => FindHelperExecutable("StubExecutable.exe", _searchPaths); + public static string SingleFileHostPath => FindHelperExecutable("singlefilehost.exe", _searchPaths); // private so we don't expose paths to internal tools. these should be exposed as a helper function private static string NugetPath => FindHelperExecutable("NuGet.exe", _searchPaths); diff --git a/src/SquirrelCli/SingleFileBundle.cs b/src/SquirrelCli/SingleFileBundle.cs index 4ad13dd5..ebd33b94 100644 --- a/src/SquirrelCli/SingleFileBundle.cs +++ b/src/SquirrelCli/SingleFileBundle.cs @@ -28,15 +28,8 @@ namespace SquirrelCli public static async Task UpdateSingleFileIcon(string sourceFile, string destinationFile, string iconPath) { using var d = Utility.WithTempDirectory(out var tmpdir); - var hostPath = Path.Combine(tmpdir, "singlefilehost.exe"); var sourceName = Path.GetFileNameWithoutExtension(sourceFile); - // extract bundled host to file - using (var hostStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SquirrelCli.singlefilehost.exe")) - using (var file = new FileStream(hostPath, FileMode.Create, FileAccess.Write)) { - hostStream.CopyTo(file); - } - // extract Update.exe to tmp dir Log.Info("Extracting Update.exe resources to temp directory"); DumpPackageAssemblies(sourceFile, tmpdir); @@ -44,13 +37,12 @@ namespace SquirrelCli // create new app host var newAppHost = Path.Combine(tmpdir, sourceName + ".exe"); HostWriter.CreateAppHost( - hostPath, // input file + HelperExe.SingleFileHostPath, // input file newAppHost, // output file sourceName + ".dll", // entry point, relative to apphost true, // isGui? Path.Combine(tmpdir, sourceName + ".dll") // copy exe resources from? ); - File.Delete(hostPath); // set new icon Log.Info("Patching Update.exe icon"); diff --git a/src/SquirrelCli/SquirrelCli.csproj b/src/SquirrelCli/SquirrelCli.csproj index 2d85e4eb..80b3c9dd 100644 --- a/src/SquirrelCli/SquirrelCli.csproj +++ b/src/SquirrelCli/SquirrelCli.csproj @@ -30,10 +30,7 @@ - - - - + diff --git a/vendor/Microsoft.NET.HostModel.dll b/vendor/Microsoft.NET.HostModel.dll new file mode 100644 index 00000000..0cd23a1a Binary files /dev/null and b/vendor/Microsoft.NET.HostModel.dll differ diff --git a/vendor/singlefilehost.exe b/vendor/singlefilehost.exe new file mode 100644 index 00000000..307067b7 Binary files /dev/null and b/vendor/singlefilehost.exe differ