Wednesday, September 28, 2011

Code Coverage and Strongly Signed Assemblies

I had a problem the other day that stumped me for a while. We just started a new project and immediately dove in to start coding. A few days later, I decided it was time to clean up the code before it got out of hand, so I ran Code Analysis and started cleaning up the problems. One I came across was this on:

System.IO.FileLoadException: Could not load file or assembly ‘xxxxxx’ or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A). File name: ‘xxxxxx’ ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

This puzzled me, because I had just finished signing the assembly with a strong name. After some Googling, I realized that it was due to the code coverage I had recently configured. After running code coverage, Visual Studio needs to re-sign the assemblies, and there is a separate place to define the key for that re-signing process. To get to it, open up your .testsettings file, go to the "Data and Diagnostics" section, click on "Code Coverage", then click the "Configure" button above.


  1. I like this usefull information, for that reason I wanna thank you for posting it and I'll follow your blog even more when you'll keep up the good work!

  2. Couldnt be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!

  3. Awesome ! You saved my day