locked
Assembly and key signing noob question RRS feed

  • Question

  • Hello.  I am a noob C# developer and I have a question that is hard to ask because I don't know anything about assemblies or keysigning.

    I am trying to get a program to compile that I downloaded off the inet but I am getting the following error.

    Error 2 Cryptographic failure while signing assembly 'C:\Documents and Settings\cstodgell\Desktop\MessageBeeper\obj\Release\MessageBeepTest.exe' -- 'Error reading key file '..\..\..\..\..\Keyfile.snk' -- The system cannot find the file specified. ' MessageBeepTest


    this error is produced from the following line of code:

    [assembly: AssemblyKeyFile("..\\..\\..\\..\\..\\Keyfile.snk")]

    I would like to know more about assemblies (what they are for, how they are used, etc. etc) but I can't find any good sources on the i-net that explains jsut what the F is goin on. 

    Thanks.
    Tuesday, September 2, 2008 4:55 PM

Answers

  • Hi -

    I'm not sure of your level of experience with development in general, so I'm not sure how basic to go.  But I will assume some previous experience working with some kind of programming or software development tools.

    Assemblies are the core component of a .NET application, and are what the Compiler will output when it successfully compiles your project.

    When you compile a .NET project or solution, the output is one or more .NET Assemblies.  Most frequently, your compiled project will be either an Executable (.exe) or  a Dynamic Link Library (.dll).  Executables are programs that can run on their own, while .dlls are libraries that are used by other executables, and cannot be run on their own.

    Signing an assembly is a way of putting a "digital stamp" on it that will verify that it was created by you and not tampered with since you created it (you being the ownder of the private key used to sign the assembly).  In this case, the error you're seeing is because Visual Studio is looking for a file that contains the keypair used to sign this assembly, and it is not finding it at the specified location.

    If you're not clear on why this would be here, then you probably don't need it.  You can delete the AssemblyKeyFile attribute (the [assembly:...] line), and it should not cause problems.  If you're interested in learning more about Assembly Signing, there are lots of resources on MSDN and the broader internet.

    Hope this helps,
    Brian
    Brian Schwalm • www.anythinksolutions.com
    Tuesday, September 2, 2008 5:53 PM
  • If you're just trying to compile code you got from somewhere else, you can just not sign the assembly.  This can be done in the properties for the project (Project menu, projectName properties...) Select the the signing tab, and uncheck Sign the assembly.

    http://www.peterRitchie.com/blog
    Tuesday, September 2, 2008 6:06 PM

All replies

  • Hi -

    I'm not sure of your level of experience with development in general, so I'm not sure how basic to go.  But I will assume some previous experience working with some kind of programming or software development tools.

    Assemblies are the core component of a .NET application, and are what the Compiler will output when it successfully compiles your project.

    When you compile a .NET project or solution, the output is one or more .NET Assemblies.  Most frequently, your compiled project will be either an Executable (.exe) or  a Dynamic Link Library (.dll).  Executables are programs that can run on their own, while .dlls are libraries that are used by other executables, and cannot be run on their own.

    Signing an assembly is a way of putting a "digital stamp" on it that will verify that it was created by you and not tampered with since you created it (you being the ownder of the private key used to sign the assembly).  In this case, the error you're seeing is because Visual Studio is looking for a file that contains the keypair used to sign this assembly, and it is not finding it at the specified location.

    If you're not clear on why this would be here, then you probably don't need it.  You can delete the AssemblyKeyFile attribute (the [assembly:...] line), and it should not cause problems.  If you're interested in learning more about Assembly Signing, there are lots of resources on MSDN and the broader internet.

    Hope this helps,
    Brian
    Brian Schwalm • www.anythinksolutions.com
    Tuesday, September 2, 2008 5:53 PM
  • If you're just trying to compile code you got from somewhere else, you can just not sign the assembly.  This can be done in the properties for the project (Project menu, projectName properties...) Select the the signing tab, and uncheck Sign the assembly.

    http://www.peterRitchie.com/blog
    Tuesday, September 2, 2008 6:06 PM
  • Thanks a lot that helps.  I'll try what you've suggested to see what happens.
    Tuesday, September 2, 2008 7:25 PM
  • Peter Ritchie said:

    If you're just trying to compile code you got from somewhere else, you can just not sign the assembly.  This can be done in the properties for the project (Project menu, projectName properties...) Select the the signing tab, and uncheck Sign the assembly.


    http://www.peterRitchie.com/blog</A< p>



     

    Awesome thanks a lot.
    Tuesday, September 2, 2008 7:27 PM