Cryptographic failure while signing assembly

Today I got a weird error on code that should just work.
📅 03 Jan 2014

Today I got a weird error on code that should just work.

Cryptographic failure while signing assembly '<Debug Assembly Full Path>' -- 'Error signing assembly -- Unknown error (8013141c)'    <Solution Full Path>\CSC

The reason why I say this was weird was because it was working before I rebooted my machine. So it was obvious from reading this error that the signing of the assembly was causing the projects build to fail.

So first thing I did was open the project properties, go to the Signing Tab and uncheck the Sign the assembly checkbox.

image

This fixed my issue, but felt wrong and I knew it would bite me later. I thought a bit more about what was different before I rebooted and now and eventually remembered that before I rebooted I was running Visual Studio in Administrator mode before.

So I re-checked the Sign the assembly checkbox closed Visual Studio and then opened the project again with a new instance of Visual Studio that was running in Administrator mode

image

Rebuilt the solution and everything built as expected