C#

Unable to obtain public key for StrongNameKeyPair

Yesterday I had to build our entire application on a box that is not my own. Sounds easy enough, just

  1. Grab all code from source control
  2. Grab any 3rd party libs
  3. Build

All went ok until I tried to build a project that used the Castle Windsor IOC container, and I got this  :

System.ArgumentException: Unable to obtain public key for StrongNameKeyPair..

System.Reflection.StrongNameKeyPair.nGetPublicKey(Boolean exported, Byte[] array, String container) System.Reflection.StrongNameKeyPair.get_PublicKey() System.AppDomain.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes) System.AppDomain.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) Castle.DynamicProxy.ModuleScope.CreateModule(Boolean signStrongName) Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithStrongName() Castle.DynamicProxy.ModuleScope.ObtainDynamicModule(Boolean isStrongNamed) Castle.DynamicProxy.Generators.Emitters.ClassEmitter.CreateTypeBuilder(ModuleScope modulescope, String name, Type (blah blah snip)

 

Massive sadness…..   <|:-(

Turns out that this is due to a permissions issue on the box I was using, where I did not have the correct privileges to create a new strong name key, due to to folder access rights. Boo

There is a special directory which has all the Crypto stuff in it :

C:\ProgramData\Microsoft\Crypto

  • DSS
  • Keys
  • RSA
  • SystemKeys

And it turns out you need to have full access to the C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys folder in particular.

One I found that folder and gave myself full read/write/delete access, my problem was solved.

Hope that helps someone else out. There was something like this on Stack Overflow which also helped me out : http://stackoverflow.com/questions/2425667/strongnamekeypair-problem-when-attempting-to-use-moq

Advertisements
Uncategorized

Windows 8 : Fun With Sensors

It has been a while since I have written an article, and I thought it was about time that I wrote one. This one is a very small one (which is somewhat unusual for me). It is a very very simple one on using some of the Windows 8 sensors. I am lucky enough to own a Windows 8 laptop that has the full compliment of sensors. So what does it do I hear you ask? Sensors are all about stuff happening, so I thought it should be some code that is quite reactive to the sensors that I chose to use. With that in mind what I thought might be cool would be to host Google Earth and have that either displaying the Earth or the Sky depending on the value of the LightSensor. When the hosted Google Earth is flipped between Earth/Stars the skin of the application is also swapped. Hopefully by swapping these 2 visual elements in reaction to the LightSensor you can see how the LightSensor code is working.

I also thought it might be fun to have the Earth/Sky change Latitude/Longitude as you tilt the laptop which causes the inbuilt Gyrometer to push out new readings.

In a nutshell that is all this article does, its quite simple, anyway if you want to know more here is a link to the article : http://www.codeproject.com/Articles/536507/Windows-8-Fun-with-sensors

Uncategorized

Node.Js / Express / Stylus / Jade / MongoDB / D3.js / Socket.IO

As the title states I have been messing around for a little while creating a small demo app that utilises some of the Node.js technology stack.

I have done this to get to try Node.js for myself. I can’t say I would swap to using it over ASP MVC and SignalR say. It has however been fun and quite intuitive for the most part, which I was surprised at. I have actually found the Node.js community to be quite lively and doing some good work.

Anyway if you fancy a read, here is a link to my article : http://www.codeproject.com/Articles/523451/Node-Js-And-Stuff

MVP

2013 Gift Horse : I’m An MVP For 2013

So I have been a bit quite on the old blog/article front of late, and I will be fixing that soon. Watch one for one on Node.Js which should be out very soon, where you can see it here/codeproject.

In the mean time I am very happy to announce that the nice people at Microsoft have seen fit to give me a MVP award for 2013. Cool. Thanks Microsoft