Visual studio signing failed (signtool.exe error)

2020-03-18 04:18发布

问题:

After accepting a minor Windows update this afternoon, I found that I could no longer make signed builds of my Visual Studio application.

Digging in to the problem, I came upon the signtool.exe program which is located in an obscure directory (C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64). Using the command prompt, I tried manually running it to sign my app, but when I did so, nothing happened: no output, no error message. I also tried running it with no parameters expecting a help message or at least an error, but again, nothing.

I went to another computer that hadn't yet received any Windows updates today, found the same file, and ran it: and it worked fine.

Thinking I must have had a damaged .exe file on the first computer, I copied the version from the other computer, but it still failed. However, if I rename the file, then it runs. For example if I rename it to "signtool1.exe" I can then run it from the command line just fine, although Visual Studio still can't run it because of the name change.

I did try rebooting my computer several times during this process thinking maybe there was a copy of it stuck in memory, but there isn't. I also searched for it in the Task Manager.

I've never seen anything like this before. The same program runs or does nothing depending on the name of the executable file. One more detail, it actually runs regardless of the filename if I copy it to my home directory. What could cause such a thing?

Thanks, Frank

回答1:

Instead of renaming signtool.exe, I found that renaming/removing signtool.exe.manifest allows signtool to run while also still allowing Visual Studio to run it.

I do not know why this is happening or what the side effects of removing the manifest are, but it's enough for my project to build again.

For reference, I encountered this issue after doing a clean VS2019 install in a clean Windows 10 1909 VM (but fully updated shortly after).



回答2:

I'm seeing the same problem. Signtool does not display any error dialogs but the error code returned is -1073741502 (0xC0000142), STATUS_DLL_INIT_FAILED.

The problem could be related to update KB4535996. I uninstalled the update when I saw the problem and signtool worked normally. The problem returned when I reinstalled the update.

Signtool works if I move the manifest file out of the directory, just like you saw. But I also noticed that signtool works when I move the manifest back into the directory.



回答3:

Here is a Bug Report at the Windows Feedback Hub. Please upvote the KB4535996 Bug Report.