VS 2005 Publish - Build Failed - SignTool reported 'Keyset does not exist' - System cannot find file specified (Exception from HRESULT:0X80070002)

-1

VS 2005 Publish - Build Failed - SignTool reported 'Keyset does not exist' -

Facing this error while publishing VB application from VS 2005 ?

visual-studio-2005
clickonce
code-signing
asked on Stack Overflow Oct 23, 2017 by Hassan • edited Oct 23, 2017 by Hassan

1 Answer

0

I have published my VB application zillion times without any issue but one fine day I ran into this sticky error. Despite of the signing certificate being there, visual studio was unable to find it. I guess this is one of those panic slow motion attacks that VS displays once in a while. After cracking my head for over two hours, finally resolved it without having to re-create a new solution from my application's forms n files, etc..as suggested on some sites.

Previously too I faced this error but I resolved it at that time by creating a new test certificate albeit I had to remove and re-install my application on client machines thereafter to take the new publish as this was a new certificate. This time Visual Studio didn't even allow me to create a new certificate. I got this nasty error when I tried - The System cannot find the file specified in visual studio (Exception from HRESULT:0X80070002). When I tried checking my certificates using certmgr.msc from Run command, I could see that my certificate was there in the Personal Store under Certificates of local current user. I also copied my certificate under trusted certificates folder but to no avail.

After doing four things my issue was finally resolved and I published my same solution happily again.

1. Close your solution. Delete the bin and obj folders of your solution. Remove the following tag lines from your .csproj file. Copy these four lines somewhere as backup.

<ManifestCertificateThumbprint>...</ManifestCertificateThumbprint>
<ManifestKeyFile>...</ManifestKeyFile>
<GenerateManifests>...</GenerateManifests>
<SignManifests>...</SignManifests>

Reopen your solution in VS and clean and re-build. Try Publishing after increasing the version number. It displays a different error that certificate is not found. Now close VS. Re-add those four lines back in the csproj file where they originally were in that file. 2. Reopen your project in VS and under Project Properties in Signing tab, uncheck the "Sign the Click Once manifests" and re-check again. Also do the same for Sign the assembly checkbox. Select the latest .pfx key. Save. Close and re-open Project Properties. (This pfx is the key generated whenever we create a new certificate. Check the date of the .pfx in project folder to know which was the last one you had created and use that one. Personally I don't give any password while creating new certificate on expiry. ) Also, add your certificate that is present in Personal Store to the Trusted Certificate Store as well using the certmgr.msc console. Simply copy your VS application issued certificate from Personal Certificates folder to Trusted Root Certificates (if there exists a trusted root authority store) in the certificate Manager console panel - the screen that comes after typing certmgr.msc in run command. 3. Now Restart your system. Yes you read that right. 4. Open your project again in VS. Increase the version now and try Publishing. Voila, the publish goes fine.

PS : VS 2005 wakes up a bit late to changes made at manifest level. Also happens sometimes for crystal reports issues :( . So better give some time to reload VS after these changes. :) Step 1 is doing just that to remind visual studio that it needs a certificate and where it finds it usually in the local keystore. So keystore does not exist error does not make sense :) !

Note that I also tried importing my existing project certificate into the local pc's Personal certificate store (list of local store certificates can be checked in certmgr.msc from Run command) using MMC run command's console Snap-In but I get the error that Cryptographic Service Provider is needed to do so and that it is not installed on my system. Also, I can see my certificate is already present there in the Personal certificate store. Its just the Visual Studio forgot where and which one it is. I read somewhere that this can happen if there are too many / multiple publishes from the development machine. :D

answered on Stack Overflow Oct 23, 2017 by Hassan • edited Oct 23, 2017 by Hassan

User contributions licensed under CC BY-SA 3.0