0

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alvin
  • 8,219
  • 25
  • 96
  • 177
  • Because I am working on a team, some pc does not have the certificate, so they cannot compile the application. – Alvin Dec 05 '12 at 09:34
  • Personally, I'd avoid the problem by having multiple configurations, some which sign, some which don't sign. Only the PC that has the certificate uses the configuration that signs the executable. But that doesn't actually answer the question you asked, which may still be of interest. –  Dec 05 '12 at 10:42
  • This makes little sense. You only sign the release build, the final one. There's no point in signing a debug build, the kind that the devs work with. – Hans Passant Dec 10 '12 at 23:41

1 Answers1

1

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.

Panos Rontogiannis
  • 4,154
  • 1
  • 24
  • 29