How to use Nuclex Framework source files?

May 18, 2011 at 11:54 PM
Edited May 19, 2011 at 12:08 AM

Hi. I have good thoughts for this framework. I think it's really useful, but I'm having troubles getting it to work on my computer.

I downloaded the sources for Nuclex Framework, and I added three Nuclex projects (Nuclex.UserInterface, Nuclex.Input, & Nuclex.Testing.Xna) into my solution in Visual Studios. Once I try to compile my game, I get errors message saying:

"Error 1 Cryptographic failure while signing assembly 'C:\XNA libraries\Nuclex Framework\nuclex-framework-r1404-sources\framework\Nuclex.Input\obj\x86\Debug\Nuclex.Input.dll' -- 'Error reading key file 'c:\XNA libraries\Nuclex Framework\nuclex-framework-r1404-sources\framework\Framework.snk' -- The system cannot find the file specified. ' Nuclex.Input (xna-4.0-x86)"

I tried looking for the Framework.snk file, but I don't think it came with the zip file I downloaded...

Also I get this warning:

"Warning 5 The referenced component 'Nuclex.UserInterface.EmbeddedContent (../../EmbeddedContent)' could not be found."

Please, someone help me understand what's going on.


May 19, 2011 at 12:22 AM


.NET assemblies can be signed with a strong name key (*.snk), which protects them from being modified post-compilation. As long as the .snk file is kept private, nobody else can recompile the assemblies and claim they came from the original author. Compiled applications will refuse replacement assemblies that are signed with a different .snk file (or not signed at all).


The Nuclex Framework binaries you can download from CodePlex have been signed with my personal .snk file, which I intentionally haven't included in the source code release. Thus, before compiling the sources, you'll have to generate your own .snk file. This is done via the command line tool sn.exe (open a "Visual Studio 2010 Command Prompt" if sn.exe isn't in your PATH variable):

snk -k Framework.snk

Make sure the .snk file is placed in the same directory as the Framework*.sln files.

May 19, 2011 at 12:24 AM

Oh, and, before you ask, I thought about shipping the sources with a default .snk file, but decided against it as then most people downloading the sources wouldn't even notice its existence, making the default .snk the de-facto standard key for all Nuclex Framework binaries that have been self-compiled, allowing anyone to replace compiled assemblies in other products with their own builds.

May 19, 2011 at 12:55 AM
Edited May 19, 2011 at 2:51 AM

Wow thanks Cygon, I can compile and run my game now ;)

BTW, I typed "sn -k Framework.snk". Typing "snk -k Framework.snk" didn't work

Though there's still that annoying warning, but I guess it doesn't matter for now.

^ I was able to fix that warning by adding the project "Nuclex.UserInterface.EmbeddedContent". It was an obvious solution :x