strong naming assembly

Discussion in 'ASP .Net' started by Derrick, Jul 30, 2004.

  1. Derrick

    Derrick Guest

    I am attempting trying to create an assembly with strong name

    Here is what I have done:
    called sn -k Tesstkey.snk
    placed this code in my class:
    using System.Reflection;

    [assembly:AssemblyKeyFileAttribute("TestKey.snk")]

    I am getting an error saying it cannot read the key file

    First, Where should that .snk file go?
    Second, What could cause that error?

    Derrick
    Derrick, Jul 30, 2004
    #1
    1. Advertising

  2. Derrick

    Shiva Guest

    Hi,

    You can give absolute path also for the .snk file.

    I believe VS.NET IDE looks for the .snk file in the devenv.exe folder
    itself.

    "Derrick" <> wrote in message
    news:9LfOc.137615$ek5.83297@pd7tw2no...
    I am attempting trying to create an assembly with strong name

    Here is what I have done:
    called sn -k Tesstkey.snk
    placed this code in my class:
    using System.Reflection;

    [assembly:AssemblyKeyFileAttribute("TestKey.snk")]

    I am getting an error saying it cannot read the key file

    First, Where should that .snk file go?
    Second, What could cause that error?

    Derrick
    Shiva, Jul 30, 2004
    #2
    1. Advertising

  3. Hi Derrick,

    As for the making stong-named asembly issue, I think you Shiva's suggestion
    that use the full absolutte path of the key file is reasonable. Since
    you're using the relative path of the file(haven't specify the full path),
    I'm not sure whether the problem is cause by this. Anyway, please have a
    try and if you have anyother findings, please also feel free to post here.
    Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
    Steven Cheng[MSFT], Jul 30, 2004
    #3
  4. Derrick,

    You can use a relative path for this, but it should be relative to the
    compiled assembly, not the project file. For example, if you keep the key
    file in the project root folder and your assemblies get compiled to <project
    root>\bin\debug or <project root>\bin\release, then your relative path must
    point up two directories. e.g.:

    [assembly: AssemblyKeyFile(@"..\..\TestKey.snk")]

    HTH,
    Nicole


    "Derrick" <> wrote in message
    news:9LfOc.137615$ek5.83297@pd7tw2no...
    >I am attempting trying to create an assembly with strong name
    >
    > Here is what I have done:
    > called sn -k Tesstkey.snk
    > placed this code in my class:
    > using System.Reflection;
    >
    > [assembly:AssemblyKeyFileAttribute("TestKey.snk")]
    >
    > I am getting an error saying it cannot read the key file
    >
    > First, Where should that .snk file go?
    > Second, What could cause that error?
    >
    > Derrick
    >
    >
    >
    >
    >
    Nicole Calinoiu, Jul 30, 2004
    #4
  5. Derrick

    Derrick Guest

    Thanks for the help.

    physical path wouldn't work because I have to move the projects between
    machines. I used Nicole's suggestion to use the relative path of
    "..\..\file.snk", and that worked. I had the file in the \bin\release\
    folder, so that should have worked, but I can work with the relative path
    approach.

    Derrick

    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hi Derrick,
    >
    > As for the making stong-named asembly issue, I think you Shiva's

    suggestion
    > that use the full absolutte path of the key file is reasonable. Since
    > you're using the relative path of the file(haven't specify the full path),
    > I'm not sure whether the problem is cause by this. Anyway, please have a
    > try and if you have anyother findings, please also feel free to post here.
    > Thanks.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    > Get Preview at ASP.NET whidbey
    > http://msdn.microsoft.com/asp.net/whidbey/default.aspx
    >
    Derrick, Jul 31, 2004
    #5
  6. Derrick

    Derrick Guest

    Thanks, Nicole

    That worked

    Derrick
    "Nicole Calinoiu" <> wrote in message
    news:...
    > Derrick,
    >
    > You can use a relative path for this, but it should be relative to the
    > compiled assembly, not the project file. For example, if you keep the key
    > file in the project root folder and your assemblies get compiled to

    <project
    > root>\bin\debug or <project root>\bin\release, then your relative path

    must
    > point up two directories. e.g.:
    >
    > [assembly: AssemblyKeyFile(@"..\..\TestKey.snk")]
    >
    > HTH,
    > Nicole
    >
    >
    > "Derrick" <> wrote in message
    > news:9LfOc.137615$ek5.83297@pd7tw2no...
    > >I am attempting trying to create an assembly with strong name
    > >
    > > Here is what I have done:
    > > called sn -k Tesstkey.snk
    > > placed this code in my class:
    > > using System.Reflection;
    > >
    > > [assembly:AssemblyKeyFileAttribute("TestKey.snk")]
    > >
    > > I am getting an error saying it cannot read the key file
    > >
    > > First, Where should that .snk file go?
    > > Second, What could cause that error?
    > >
    > > Derrick
    > >
    > >
    > >
    > >
    > >

    >
    >
    Derrick, Jul 31, 2004
    #6
  7. Derrick

    dananos

    Joined:
    Aug 6, 2008
    Messages:
    4
    Hi,

    This approach to signing assemblies is out of date, you should right click on your project, select Properties > Signing, then check the box "Sign the assembly". Your SNK files should already be in the project folder.

    Regards

    Dan
    dananos, Aug 6, 2008
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. C

    Strong Naming

    C, Nov 5, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    403
    Steve C. Orr [MVP, MCSD]
    Nov 6, 2003
  2. Replies:
    2
    Views:
    3,502
  3. namekuseijin

    Re: "Strong typing vs. strong testing"

    namekuseijin, Sep 27, 2010, in forum: C Programming
    Replies:
    214
    Views:
    3,341
    Nick Keighley
    Oct 17, 2010
  4. namekuseijin

    Re: "Strong typing vs. strong testing"

    namekuseijin, Sep 27, 2010, in forum: Python
    Replies:
    229
    Views:
    3,438
    Gregory Ewing
    Oct 29, 2010
  5. Elmo Watson
    Replies:
    0
    Views:
    563
    Elmo Watson
    Nov 9, 2007
Loading...

Share This Page