4

I have a project that I'm upgrading to Visual Studio 2015 but it's still targeting .NET 4.5.1.

Whenever $(WindowsSDKBinPath) is set to the Windows 10 SDK "C:\Program Files (x86)\Windows Kits\10\bin\x86\" the signtool.exe exits with exit code 255 and the output cuts off like the following:

The following certificate was selected:
    Issued to: XXXX
    Issued by: VeriSign Class 3 Code Signing 2010 CA
    Expires:   Tue Apr 11 19:59:59 2017
    SHA1 hash: XXXX

Done Adding Additional Store

Usually an error would show up right here if there was going to be an error but that's it, it's cuts off right here and exits with exit code 255.

If $(WindowsSDKBinPath) is set to the Windows 8.1 SDK "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\" then everything is fine. SignTool.exe signs the dll without any issues and exits with code 0 like normal.

Can anyone help me figure out how to use the newer signtool or at least know why it's not working? Below is the target I added to my csproj file to get it to sign after building. Thanks.

<Target Name="AuthenticodeProjectSign" AfterTargets="AfterBuild">
  <PropertyGroup>
    <AuthenticodeTimestampServerUrl>http://timestamp.verisign.com/scripts/timstamp.dll</AuthenticodeTimestampServerUrl>
    <TargetAssembly>$(OutDir)$(TargetFileName)</TargetAssembly>
  </PropertyGroup>

  <Exec Command="&quot;$(WindowsSDKBinPath)signtool.exe&quot; sign /v /sha1 $(AuthenticodeCertificateSHA1) /t $(AuthenticodeTimestampServerUrl) &quot;$(TargetAssembly)&quot;" />
</Target>
Aaron Stainback
  • 3,489
  • 2
  • 31
  • 32
  • 1
    While unfortunately I do not have an answer to this problem, I just wanted to say thank you for helping me solve mine. I had the exact same issue. Trying to use the Windows 10 SDK SignTool.exe resulted in the 255 exit code. (Which lead me here). Adding the ClickOnce Publishing Tools to VS and then using the 8.1 SDK SignTool.exe worked just fine (as you mentioned in your question). Not sure if it's a bug or what in the new signtool, but I was happy to get things working. Thanks. – David Cardinale Dec 01 '16 at 19:42
  • Have you found a way to get it working with windows 10 sdk? We are also doing this workaround but it would be fine to know why it is not working with the win 10 sdk version :-s – Scordo Apr 18 '17 at 16:23

2 Answers2

2

signtool @ my Machine and on the buildserver is working. On VisualStudio 2015 and Windows 10 Enterprise 64bit, I had to add the ClickOnce Publishing Tools in VisualStudio Setup: Visual Studio 2015 Setup where you can add ClickOnce

After this you find signtool.exe in

  • c:\Program Files (x86)\Windows Kits\8.1\bin\x64\
  • c:\Program Files (x86)\Windows Kits\8.1\bin\x86\
  • c:\Program Files (x86)\Windows Kits\8.1\bin\arm\
gReX
  • 1,060
  • 1
  • 20
  • 35
  • My problem is not that I'm missing signtool, it's that signtool fails silently. – Aaron Stainback Mar 04 '16 at 16:18
  • ok, sorry for not helpful. I have no Idea, why th newer version is not working, but the older one does. Why do you need the new Version? Maybe there are problems with the timestampserver see http://stackoverflow.com/questions/19123736/postbuild-event-fails-in-visual-studio-after-signtool-exe-error – gReX Mar 07 '16 at 13:09
0

I ran into the same problem where signtool exits with exit code 255 when using :

C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe

But somehow it works fine using :

C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe