mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Remove dependency on local SDK for update re-bundling
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -30,10 +30,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Requires SDK 6.0.100, used for re-compiling Update.exe with a new icon. I think it's important to take this from the SDK -->
|
||||
<!-- during build, so the bundled version of the singlefilehost matches the one used by msbuild when it first created Update.exe -->
|
||||
<Reference Include="C:\Program Files\dotnet\sdk\6.0.100\Microsoft.NET.HostModel.dll" />
|
||||
<EmbeddedResource Include="C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win-x86\6.0.0\runtimes\win-x86\native\singlefilehost.exe" />
|
||||
<Reference Include="..\..\vendor\Microsoft.NET.HostModel.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
BIN
vendor/Microsoft.NET.HostModel.dll
vendored
Normal file
BIN
vendor/Microsoft.NET.HostModel.dll
vendored
Normal file
Binary file not shown.
BIN
vendor/singlefilehost.exe
vendored
Normal file
BIN
vendor/singlefilehost.exe
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user