Lee Z
Lee Z

Reputation: 964

New SignTool Certificate and Password causes MSBuild/WiX postbuild events to fail

I have been using PostBuild events in my deployment solution in both my DLL project and my WiX project (used to build an MSI) successfully for the last 4 years. Recently, we received a new certificate and password since the prior certificate expired.

I can no longer build my solution as both the PostBuild event for the DLL and the WiX PostBuild events fail.

I commented out the SignTool commands in both the DLL project and the WiX project and both projects build correctly.

When the following signtool command is included in the PostBuild event, I receive an error that the PostBuild exited with -1

EXEC : SignTool error : The specified PFX password is not correct.

The DLL PostBuild Event calls SignTool as follows:

"$(SolutionDir)\Certificates\signtool.exe" sign /f "$(SolutionDir)\Certificates\MyCertificate.pfx" /p Pass%word& -t http://timestamp.verisign.com/scripts/timstamp.dll /v "$(TargetDir)MyDll.dll"

When attempting to run the same command in command prompt, the message below is received if double quotes are not enclosed in double quotes.

SignTool Error: Missing filename.
'e' is not recognized as an internal or external command, operable program or batch file.

When attempting to run SignTool via the command line, it works if the password is enclosed in double quotes.

No matter what is done in regards to enclosing the password in double quotes, the project will not compile.

I have read that Visual Studio (and msbuild?) scan the output for certain words and to determine that the process failed. I noticed that when running the SignTool process, I receive the following at the end of the process and wonder if this has to do with the word errors.

Number of files successfully Signed: 1
Number of warnings: 0
Number of errors: 0

Upvotes: 0

Views: 1252

Answers (1)

Lee Z
Lee Z

Reputation: 964

I had to use escape characters for the special characters.

Brian Sutherland was correct

Upvotes: 1

Related Questions