Geeks With Blogs

News
Welcome to my blog.
Here's what we've got on the menu today:

Lorin Thwaits A geek says what?

I had an error that was been driving me up the wall, CS0234: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'.  This always happened while developing a web application in Visual Studio 2005 and wanting to use code that deals with certificates.  During development Intellisense would find the System.Security.Cryptography.Pkcs namespace just fine.  But it couldn't be found at runtime.  I had registered the System.Security assembly, and the project always built just fine.  The resulting assembly seemed perfectly normal.  But no matter what I tried, even reinstalling the .NET framework on the machine, would make that dumb error go away.

Well, after more tinkering I found out the issue is all in the web.config.  If you (1) install the normal payware version of Visual Studio 2005 and then (2) Install Visual Web Developer Express 2005 then later as you go back and develop with the payware version of Visual Studio then when you register assemblies it does not always add the references in the web.config file!  So the fix in my case was to change the <compilation> element in the web.config, found under <system.web>:

<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<
compilation debug="true">
 

I just modified it to include the assembly reference like this:

<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<
compilation debug="true">
<
assemblies>
<
add assembly="System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</
assemblies>
</
compilation>

Now at runtime everything works great!

Posted on Tuesday, February 12, 2008 8:05 AM VS2005 , Errors | Back to top


Comments on this post: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
i think it is great
Left by ed hardy shoes on Aug 12, 2009 8:56 AM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
think it is great
Left by auto insurance quotes on Sep 12, 2009 11:29 PM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
Hi, just wanted to say a BIG thanks! I hit this problem when I updated my 2.0 project to 3.5, your fixed worked in seconds =)
Left by John Doherty on Oct 24, 2009 1:58 PM

# rny one got reply here plz
Requesting Gravatar...
Even iam looking for the same informatiom
Left by buy lasix online on Dec 17, 2009 12:48 AM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
Thank u really to think this write up is a 'good bit' i apreciate that from you...
Left by Cheap Lasix on Jan 12, 2010 3:01 AM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
Thank you! Thank you! Thank you!
Left by Marc on Jan 25, 2010 3:20 PM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
It is great to see. Thanks for such great post.
Left by Accounting Services on Jan 29, 2010 5:10 AM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
http://www.abercrombie4sale.com
Thank you for sharing.
Left by letty on Feb 25, 2010 9:08 PM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
Thank you for sharing.
Left by letty on Feb 25, 2010 9:09 PM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
Excellent post, thank you very much for taking the time to share with those who are starting on the subject. Greetings
Left by Biletul Zilei on Mar 04, 2010 7:31 AM

# re: The type or namespace name 'Pkcs' does not exist in the namespace 'System.Security.Cryptography'
Requesting Gravatar...
Excellent blog post.
Left by bike games on Mar 06, 2010 8:19 PM

Your comment:
 (will show your gravatar)


Copyright © Lorin Thwaits | Powered by: GeeksWithBlogs.net