As we all know, in Visual Studio, you can use Post build to perform operations similar to cmd or batch processing. Microsoft's signtool is used in recent projects to sign a digital signature to a. xap (Silverlight compiled file) file.
Background: because the digital signature is about to expire, You need to replace the previous one with the new one. The letter signature is a file (XXX. pfx) applied by the IT department of the company, and the password is also provided by them. Because the IT department requires password protection, the Password Must Meet the so-called security rules, IT Department colleagues set the password to a string with "special characters" _ x % v? Xxx ^ xx2 "(X indicates a letter, which is considered safe and inconvenient to directly release the password :)). Therefore, when running the post build command, an error is reported: missing file...
"$ (Projectdir) signtool" sign/F "$ (projectdir) mysign. pfx"/P _ x % v? Xxx ^ xx2 "$ (targetdir) clientapplication. xap"
Solution: Check the special characters in the next batch and find that special characters must be processed using % or ^ (for example, add a % before the special character % to output % correctly ), in addition, strings containing special characters must be included in. The modified post build command is as follows:
"$ (Projectdir) signtool" sign/F "$ (projectdir) mysign. pfx"/P "_ x % v? Xxx ^ xx2 "$ (targetdir) clientapplication. xap"
Use the modified post build command to compile again. The result is correct... Good job !!
I also attached a link for processing special characters for batch processing, hoping to help: http://www.hackbase.com/tech/2009-09-27/56481.html
Vs 2012: Use signtool.exe in post build. The handling method for characters in special passwords