Prevent the 'signtool.exe' command from running when a certificate is not available

StackOverflow https://stackoverflow.com/questions/13717415

  •  04-12-2021
  •  | 
  •  

سؤال

I am adding the following to post-build command line in a build event to sign the application EXE file with a certificate:

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\signtool.exe" sign /t "http://timestamp.digicert.com" /n "XXX INC" "$(ProjectDir)obj\x86\Debug\app.exe"

How can I prevent this line from executing when the certificate "XXX INC" is not available?

هل كانت مفيدة؟

المحلول

You can use the IF EXIST batch statement. I'm not sure if you can add it directly to the PostBuild event, but you can easilly create a .bat file, insert all commands there and call it in your project's PostBuild event.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top