Code Signing

Jan 30, 2015 at 12:50 PM
Edited Jan 30, 2015 at 12:53 PM
Just want to report that while the "Signing" sample was of great help, the code didn't work with "signtool not found error.
In the end I implemented that method (which inject the path to signtool)

Perhaps you could update the Tasks.DigitalySign() method?

static void SignMSI(string msi)
    var path = Environment.GetEnvironmentVariable("PATH");
    var cmdpath = @"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin";
    if (!path.Contains(cmdpath))
        Environment.SetEnvironmentVariable("PATH", cmdpath + ";" + path);
    int exitCode = Tasks.DigitalySign(msi,
    if (exitCode != 0)
        Console.WriteLine("Could not sign the MSI file.");
        Console.WriteLine("the MSI file was signed successfully.");

Jan 31, 2015 at 1:57 AM
I just extended the buit-in wll-known locations of the SignTool.exe with your extra path to allow a better probing for the tool executable.

I also added an optional parameter to CommonTasks.Tasks.DigitalySign to allow a user defined location of the tool:
int DigitalySign(string fileToSign, string pfxFile, string timeURL, string password, string optionalArguments = null, string wellKnownLocations = null)
The change is commited and will be available with the next release

Jan 31, 2015 at 4:04 AM
Well done Oleg! :)