Strong naming problem


L

Larry Smith

Hi there,

I'm trying to publish my web site from VS by right-clicking the project and
selecting "Publish Web Site". On the dialog that appears, I then check
"Enable strong naming on precompiled assemblies" and enter the name of my
".pfx" file in the "Key file location" field. The following error results
however when I proceed with publishing:

"Error 5 Cryptographic failure while signing assembly 'c:\Documents and
Settings\Developer1\Local Settings\Temp\Temporary ASP.NET
Files\publish\8cf0e763\82cfb5f8\App_Web_boczeoov.dll' -- 'Bad Version of
provider. ' "

Note that my ".pfx" file was issued by a well-known certificate authority
and works everywhere else I use it in VS (or otherwise). I tried using a
".snk" file above instead (after converting my ".pfx" to a ".snk" file using
"sn.exe") but that results in:

"Error 5 Cryptographic failure while signing assembly 'c:\Documents and
Settings\Developer1\Local Settings\Temp\Temporary ASP.NET
Files\publish\8cf0e763\82cfb5f8\App_Web_5cvwn6lo.dll' -- 'Key file
'c:\MyProject.snk' is missing the private key needed for signing' "

I also tried doing all this from the command line outside of VS (using
"aspnet_compiler.exe") but the problem persists. Can anyone shed any light
as I've already Googled extensively with no luck. Thanks.
 
Ad

Advertisements

G

Gaurav Vaish \(a.k.a. MasterGaurav\)

Hi Larry,
I'm trying to publish my web site from VS by right-clicking the project
and selecting "Publish Web Site". On the dialog that appears, I then check
"Enable strong naming on precompiled assemblies" and enter the name of my
".pfx" file in the "Key file location" field. The following error results
however when I proceed with publishing:

pfx file is not for "strong-naming" the assemblies. It's for
digitally-sigining any module (exe, dll or otherwise).

The snk file (created from sn) will be used to sign the assembly.

:
: "Error 5 Cryptographic failure while signing assembly 'c:\Documents and
: Settings\Developer1\Local Settings\Temp\Temporary ASP.NET
: Files\publish\8cf0e763\82cfb5f8\App_Web_5cvwn6lo.dll' -- 'Key file
: 'c:\MyProject.snk' is missing the private key needed for signing' "

I think MyProject.snk contains only the public key.
Just tryout the following at command line (create a dummy class
HelloWorld.cs):

C:\>csc /keyfile:MyProject.snk /out:HelloWorld.dll /t:library HelloWorld.cs

If you get the error, it's time to regenerate the key (sn -k).


--
Happy Hacking,
Gaurav Vaish
http://blogs.mastergaurav.com
http://eduzine.edujini-labs.com
---------------------------
 
Ad

Advertisements

L

Larry Smith

pfx file is not for "strong-naming" the assemblies. It's for
digitally-sigining any module (exe, dll or otherwise).

Thanks but I don't think that's entirely correct. You should be able to use
either AFAIK. In fact, you can use a ".snk" or ".pfx" file to sign
assemblies in VS and ".pfx" files are normally recommended because they're
password protected (unlike ".snk" files). This doesn't work for precompiled
website assemblies however (as noted in my first post) and I don't know why.
The same ".pfx" file works for all other assemblies.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top