clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
426 stars 39 forks source link

Problems using a custom signing tool with v3 / csq #133

Closed Zache closed 10 months ago

Zache commented 1 year ago

I'm trying to use azuresigntool to sign with and I'm not having any success, I'm pretty sure it has to do with x86 vs x64 but I am struggling to solve this.

The error reported is: [ERRO] System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'azuresigntool sign <secrets and stuff> -v "%temp%\Clowd.Squirrel\temp.3\lib\win\MyApp_ExecutionStub.exe"' with working directory '<dir where i called csq>'. The system cannot find the file specified. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Squirrel.PlatformUtil.InvokeProcess(ProcessStartInfo psi, CancellationToken ct) in ./Squirrel/Internal/PlatformUtil.cs:line 454 at Squirrel.PlatformUtil.InvokeProcess(String fileName, IEnumerable1 args, String workingDirectory, CancellationToken ct) in ./Squirrel/Internal/PlatformUtil.cs:line 487 at Squirrel.CommandLine.Windows.HelperExe.SignPEFileWithTemplate(String filePath, String signTemplate) in ./Squirrel.CommandLine/Windows/HelperExe.cs:line 110 at Squirrel.CommandLine.Windows.SigningOptions.SignFiles(String rootDir, String[] filePaths) in ./Squirrel.CommandLine/Windows/Options.cs:line 53 at Squirrel.CommandLine.Windows.Commands.<>c__DisplayClass4_0.b__7(String pkgPath, ZipPackage zpkg) in ./Squirrel.CommandLine/Windows/Commands.cs:line 192 at Squirrel.CommandLine.ReleasePackageBuilder.CreateReleasePackage(String outputFile, Func2 releaseNotesProcessor, Action2 contentsPostProcessHook) in ./Squirrel.CommandLine/ReleasePackageBuilder.cs:line 121 at Squirrel.CommandLine.Windows.Commands.Releasify(ReleasifyOptions options) in ./Squirrel.CommandLine/Windows/Commands.cs:line 97 at Squirrel.CommandLine.Windows.Commands.Pack(PackOptions options) in ./Squirrel.CommandLine/Windows/Commands.cs:line 39 at Squirrel.CommandLine.CommandAction1.Execute(IEnumerable1 args) in ./Squirrel.CommandLine/ValidatedOptionSet.cs:line 168 at Squirrel.CommandLine.CommandSet.Execute(String[] args) in ./Squirrel.CommandLine/ValidatedOptionSet.cs:line 214 at Squirrel.CommandLine.SquirrelHost.Main(String[] args) in ./Squirrel.CommandLine/SquirrelHost.cs:line 85`

The call to csq:

dotnet csq --csq-version=3.0.210-g5f9f594 --verbose pack --icon ".\src\MyApp\MyApp.ico" --packDir ./target --packAuthors "My team" -appIcon ".\src\MyApp\MyApp.ico" --signSkipDll --packTitle "MyApp" --releaseDir ./releases -u "MyApp" -v "0.0.1" --signTemplate 'azuresigntool sign <secrets > -v {{file}}' --verbose -e MyApp.exe

caesay commented 1 year ago

The error is "The system cannot find the file specified.". In other words, windows shell doesn't know what "azuresigntool" is. You probably need to fully-qualify the path to azuresigntool.exe. Example:

--signTemplate 'C:\path\to\azuresigntool.exe sign <secrets > -v {{file}}'

Zache commented 1 year ago

I tried a bunch of variations of that, it didn't work. But what did work was using version 2.9.42 and calling Squirrel.exe instead. I'll do some more investigation and to see if I can get csq to work.

caesay commented 1 year ago

Will re-open this and have a look at this in the context of csq, thanks for the clarification.

Zache commented 1 year ago

I tried to take inspiration from what you do with csq with this:

--signTemplate 'dotnet <absolute path>\azuresigntool.dll sign

But that didn't work either. If I run this C:\Windows\System32\cmd.exe /c dotnet <absolute path>\azuresigntool.dll --help that works.

caesay commented 1 year ago

I think the best debugging steps will be to run squirrel locally with debugger and inspect the --signTemplate string that gets parsed by Squirrel.CommandLine.

caesay commented 10 months ago

Should be fixed in v4