title: Signing assemblies with strong name using pfx and visual studio
body: <p>So here is the problem: We have decided to buy a code signing certificate, we bought one from Godaddy which was in p12 format.</p>
  
  <p>After researching I found out that p12 and pfx is the same thing with a different extension so I renamed it to pfx. I also got spc and p7c files but I don't have a clue what to do with them.</p>
  
  <p>Anyway, I tried to add my certificate to my Visual Studio 2013 solution and here is what I get:</p>
  
  <ul>
  <li><p>First I get a password prompt and after I input the password I am
  getting an error saying</p>
  
  <pre><code>"An attempt was made to reference a token that does not exist."
  </code></pre></li>
  <li><p>On my second try to install the pfx I am getting no prompts or error messages at all but when I build I am getting the error</p>
  
  <pre><code>"Cannot import the following key file: something.pfx 
  The key file may be password protected.
  To correct this, try to import the certificate again or 
  manually install the certificate to the Strong Name CSP with the following
  key container name: VS_KEY_33FA18307607ECFB"
  </code></pre></li>
  <li><p>So I am doing that using </p>
  
  <pre><code>sn -i something.pfx VS_KEY_33FA18307607ECFB
  </code></pre>
  
  <p>which completes with no errors but when I try
  to build again I am getting the exact same error with the same container name.</p>
  
  <pre><code>"Cannot import the following key file: something.pfx ....
  </code></pre></li>
  </ul>
  
  <p>I tried to use the signtool which is what Goddady support recommends as an alternative but although it signs the assembly it does not provide strongnaming which I need.</p>
  
  <p>I also tried to extract the certificate from the pfx to an snk using</p>
  
  <pre><code>    sn -p something.pfx key.snk
  </code></pre>
  
  <p>and selected delayed signing but the project didn't build again with even more errors.</p>
  
  <p>Rhetorical question: why is this so hard? So many people have problems with this.</p>
  
  <p>Can someone please help?</p>