Fix codesign on Windows with the latest SDK
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Flax.Build;
|
||||
using Flax.Build.Platforms;
|
||||
using Flax.Build.Projects.VisualStudio;
|
||||
@@ -288,10 +287,25 @@ namespace Flax.Deploy
|
||||
var sdks = WindowsPlatformBase.GetSDKs();
|
||||
if (sdks.Count == 0)
|
||||
throw new Exception("No Windows SDK found. Cannot sign file.");
|
||||
var sdkKeys = sdks.Keys.ToList();
|
||||
sdkKeys.Sort();
|
||||
var sdk = sdks[sdkKeys.Last()];
|
||||
var signtool = Path.Combine(sdk, "bin", "x64", "signtool.exe");
|
||||
var signtool = string.Empty;
|
||||
foreach (var e in sdks)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sdk = e.Value;
|
||||
signtool = Path.Combine(sdk, "bin", "x64", "signtool.exe");
|
||||
if (File.Exists(signtool))
|
||||
break;
|
||||
var ver = WindowsPlatformBase.GetSDKVersion(e.Key);
|
||||
signtool = Path.Combine(sdk, "bin", ver.ToString(4), "x64", "signtool.exe");
|
||||
if (File.Exists(signtool))
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore version formatting exception
|
||||
}
|
||||
}
|
||||
var cmdLine = string.Format("sign /debug /f \"{0}\" /p \"{1}\" /tr http://timestamp.comodoca.com /td sha256 /fd sha256 \"{2}\"", certificatePath, certificatePass, file);
|
||||
Utilities.Run(signtool, cmdLine, null, null, Utilities.RunOptions.Default | Utilities.RunOptions.ThrowExceptionOnError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user