Strong Naming an ASP.Net Project

Discussion in 'ASP .Net' started by Manuel Lopez, Dec 1, 2003.

  1. Manuel Lopez

    Manuel Lopez Guest

    Hello,

    I have a Web Project (UserControls.dll) with some user controls that
    is shared by many asp.net web applicattions.

    What we do is copy UserControls.dll to all the applications bin
    folders an this works correctly.

    We want to have this shared code in the GAC.

    Wit other non-web projects we create a snk file, add it to the project
    and compile. Later we register this dll manually in the GAC.

    I have been trying to do this with a web project , and all the time I
    get an error saying that it cannot read the snk file.

    Is it possible to strong name the generated dll of a web project?

    Thanks in Advance.

    Manuel
    Manuel Lopez, Dec 1, 2003
    #1
    1. Advertising

  2. Yes it is, but with ASP.NET there are two places where a binary is built.
    You may have to put the strong name in the temporary directory where things
    are built:

    c:\documents and
    settings\<userName>\VSWebCache\<machineName>\<applicationName>


    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows Client
    Windows XP Associate Expert
    --
    More people read the newsgroups than read my email.
    Reply to the newsgroup for a faster response.
    (Control-G using Outlook Express)
    --

    "Manuel Lopez" <> wrote in message
    news:...
    > Hello,
    >
    > I have a Web Project (UserControls.dll) with some user controls that
    > is shared by many asp.net web applicattions.
    >
    > What we do is copy UserControls.dll to all the applications bin
    > folders an this works correctly.
    >
    > We want to have this shared code in the GAC.
    >
    > Wit other non-web projects we create a snk file, add it to the project
    > and compile. Later we register this dll manually in the GAC.
    >
    > I have been trying to do this with a web project , and all the time I
    > get an error saying that it cannot read the snk file.
    >
    > Is it possible to strong name the generated dll of a web project?
    >
    > Thanks in Advance.
    >
    > Manuel
    Chris Jackson, Dec 1, 2003
    #2
    1. Advertising

  3. Manuel Lopez

    Manuel Lopez Guest

    Hello Chris,

    Thanks for the reply.

    Our problem is that we cannot compile our web project with
    the user controls when we add a snk file and reference it
    from Assembly file.

    It seems as if you cannot use then with web projects.


    >-----Original Message-----
    >Yes it is, but with ASP.NET there are two places where a

    binary is built.
    >You may have to put the strong name in the temporary

    directory where things
    >are built:
    >
    >c:\documents and
    >settings\<userName>\VSWebCache\<machineName>\<applicationN

    ame>
    >
    >
    >--
    >Chris Jackson
    >Software Engineer
    >Microsoft MVP - Windows Client
    >Windows XP Associate Expert
    >--
    >More people read the newsgroups than read my email.
    >Reply to the newsgroup for a faster response.
    >(Control-G using Outlook Express)
    >--
    >
    >"Manuel Lopez" <> wrote in message
    >news:...
    >> Hello,
    >>
    >> I have a Web Project (UserControls.dll) with some user

    controls that
    >> is shared by many asp.net web applicattions.
    >>
    >> What we do is copy UserControls.dll to all the

    applications bin
    >> folders an this works correctly.
    >>
    >> We want to have this shared code in the GAC.
    >>
    >> Wit other non-web projects we create a snk file, add it

    to the project
    >> and compile. Later we register this dll manually in the

    GAC.
    >>
    >> I have been trying to do this with a web project , and

    all the time I
    >> get an error saying that it cannot read the snk file.
    >>
    >> Is it possible to strong name the generated dll of a

    web project?
    >>
    >> Thanks in Advance.
    >>
    >> Manuel

    >
    >
    >.
    >
    Manuel Lopez, Dec 1, 2003
    #3
  4. I may be missing what you are asking here. Are you trying to compile the
    project you are strong naming and failing? If that is the case, then you
    need to move the SNK file. The error that is generated should tell you the
    directory it is searching in and failing to find it. Have you compiled and
    strong named an assembly, and having trouble referencing it? You should
    definitely be able to reference a strong named file - that also works. You
    just need to make sure it is in the search path. What is the error that you
    are seeing?

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows Client
    Windows XP Associate Expert
    --
    More people read the newsgroups than read my email.
    Reply to the newsgroup for a faster response.
    (Control-G using Outlook Express)
    --

    "Manuel Lopez" <> wrote in message
    news:0ae201c3b833$8a338160$...
    > Hello Chris,
    >
    > Thanks for the reply.
    >
    > Our problem is that we cannot compile our web project with
    > the user controls when we add a snk file and reference it
    > from Assembly file.
    >
    > It seems as if you cannot use then with web projects.
    >
    >
    > >-----Original Message-----
    > >Yes it is, but with ASP.NET there are two places where a

    > binary is built.
    > >You may have to put the strong name in the temporary

    > directory where things
    > >are built:
    > >
    > >c:\documents and
    > >settings\<userName>\VSWebCache\<machineName>\<applicationN

    > ame>
    > >
    > >
    > >--
    > >Chris Jackson
    > >Software Engineer
    > >Microsoft MVP - Windows Client
    > >Windows XP Associate Expert
    > >--
    > >More people read the newsgroups than read my email.
    > >Reply to the newsgroup for a faster response.
    > >(Control-G using Outlook Express)
    > >--
    > >
    > >"Manuel Lopez" <> wrote in message
    > >news:...
    > >> Hello,
    > >>
    > >> I have a Web Project (UserControls.dll) with some user

    > controls that
    > >> is shared by many asp.net web applicattions.
    > >>
    > >> What we do is copy UserControls.dll to all the

    > applications bin
    > >> folders an this works correctly.
    > >>
    > >> We want to have this shared code in the GAC.
    > >>
    > >> Wit other non-web projects we create a snk file, add it

    > to the project
    > >> and compile. Later we register this dll manually in the

    > GAC.
    > >>
    > >> I have been trying to do this with a web project , and

    > all the time I
    > >> get an error saying that it cannot read the snk file.
    > >>
    > >> Is it possible to strong name the generated dll of a

    > web project?
    > >>
    > >> Thanks in Advance.
    > >>
    > >> Manuel

    > >
    > >
    > >.
    > >
    Chris Jackson, Dec 1, 2003
    #4
  5. Manuel Lopez

    Manuel Lopez Guest

    Hello Again Chris,

    My problem is that i can´t generate the strong name "web"
    project.

    The snk file is the at the same level of of vbproj file,
    and in assembly i have :

    <Assembly: AssemblyKeyFile("..\..\Keys.snk")>

    I have tried copying the snk file to the bin directory,
    changing the path and it just doesn´t work for a "Web"
    project.

    Maybe you just can´t strong name a "Web" through Visual
    Studio.

    Thanks

    >-----Original Message-----
    >I may be missing what you are asking here. Are you trying

    to compile the
    >project you are strong naming and failing? If that is the

    case, then you
    >need to move the SNK file. The error that is generated

    should tell you the
    >directory it is searching in and failing to find it. Have

    you compiled and
    >strong named an assembly, and having trouble referencing

    it? You should
    >definitely be able to reference a strong named file -

    that also works. You
    >just need to make sure it is in the search path. What is

    the error that you
    >are seeing?
    >
    >--
    >Chris Jackson
    >Software Engineer
    >Microsoft MVP - Windows Client
    >Windows XP Associate Expert
    >--
    >More people read the newsgroups than read my email.
    >Reply to the newsgroup for a faster response.
    >(Control-G using Outlook Express)
    >--
    >
    >"Manuel Lopez" <>

    wrote in message
    >news:0ae201c3b833$8a338160$...
    >> Hello Chris,
    >>
    >> Thanks for the reply.
    >>
    >> Our problem is that we cannot compile our web project

    with
    >> the user controls when we add a snk file and reference

    it
    >> from Assembly file.
    >>
    >> It seems as if you cannot use then with web projects.
    >>
    >>
    >> >-----Original Message-----
    >> >Yes it is, but with ASP.NET there are two places where

    a
    >> binary is built.
    >> >You may have to put the strong name in the temporary

    >> directory where things
    >> >are built:
    >> >
    >> >c:\documents and

    >>

    >settings\<userName>\VSWebCache\<machineName>\<applicationN
    >> ame>
    >> >
    >> >
    >> >--
    >> >Chris Jackson
    >> >Software Engineer
    >> >Microsoft MVP - Windows Client
    >> >Windows XP Associate Expert
    >> >--
    >> >More people read the newsgroups than read my email.
    >> >Reply to the newsgroup for a faster response.
    >> >(Control-G using Outlook Express)
    >> >--
    >> >
    >> >"Manuel Lopez" <> wrote in message
    >> >news:...
    >> >> Hello,
    >> >>
    >> >> I have a Web Project (UserControls.dll) with some

    user
    >> controls that
    >> >> is shared by many asp.net web applicattions.
    >> >>
    >> >> What we do is copy UserControls.dll to all the

    >> applications bin
    >> >> folders an this works correctly.
    >> >>
    >> >> We want to have this shared code in the GAC.
    >> >>
    >> >> Wit other non-web projects we create a snk file, add

    it
    >> to the project
    >> >> and compile. Later we register this dll manually in

    the
    >> GAC.
    >> >>
    >> >> I have been trying to do this with a web project ,

    and
    >> all the time I
    >> >> get an error saying that it cannot read the snk file.
    >> >>
    >> >> Is it possible to strong name the generated dll of a

    >> web project?
    >> >>
    >> >> Thanks in Advance.
    >> >>
    >> >> Manuel
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >
    Manuel Lopez, Dec 2, 2003
    #5
  6. You can strong name it, you just have to manually drag the SNK file to the
    VSWebCache folder (as indicated in my first post). VS.NET does not provide
    the mechanisms, though the error message should help you locate the proper
    directory. The folder in inetpub is NOT where it goes. I have done it
    before, I just don't have any on this machine to give you the exact
    location, but I promise you that it works.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows Client
    Windows XP Associate Expert
    --
    More people read the newsgroups than read my email.
    Reply to the newsgroup for a faster response.
    (Control-G using Outlook Express)
    --

    "Manuel Lopez" <> wrote in message
    news:afa901c3b8b6$b56a0a10$...
    Hello Again Chris,

    My problem is that i can´t generate the strong name "web"
    project.

    The snk file is the at the same level of of vbproj file,
    and in assembly i have :

    <Assembly: AssemblyKeyFile("..\..\Keys.snk")>

    I have tried copying the snk file to the bin directory,
    changing the path and it just doesn´t work for a "Web"
    project.

    Maybe you just can´t strong name a "Web" through Visual
    Studio.

    Thanks

    >-----Original Message-----
    >I may be missing what you are asking here. Are you trying

    to compile the
    >project you are strong naming and failing? If that is the

    case, then you
    >need to move the SNK file. The error that is generated

    should tell you the
    >directory it is searching in and failing to find it. Have

    you compiled and
    >strong named an assembly, and having trouble referencing

    it? You should
    >definitely be able to reference a strong named file -

    that also works. You
    >just need to make sure it is in the search path. What is

    the error that you
    >are seeing?
    >
    >--
    >Chris Jackson
    >Software Engineer
    >Microsoft MVP - Windows Client
    >Windows XP Associate Expert
    >--
    >More people read the newsgroups than read my email.
    >Reply to the newsgroup for a faster response.
    >(Control-G using Outlook Express)
    >--
    >
    >"Manuel Lopez" <>

    wrote in message
    >news:0ae201c3b833$8a338160$...
    >> Hello Chris,
    >>
    >> Thanks for the reply.
    >>
    >> Our problem is that we cannot compile our web project

    with
    >> the user controls when we add a snk file and reference

    it
    >> from Assembly file.
    >>
    >> It seems as if you cannot use then with web projects.
    >>
    >>
    >> >-----Original Message-----
    >> >Yes it is, but with ASP.NET there are two places where

    a
    >> binary is built.
    >> >You may have to put the strong name in the temporary

    >> directory where things
    >> >are built:
    >> >
    >> >c:\documents and

    >>

    >settings\<userName>\VSWebCache\<machineName>\<applicationN
    >> ame>
    >> >
    >> >
    >> >--
    >> >Chris Jackson
    >> >Software Engineer
    >> >Microsoft MVP - Windows Client
    >> >Windows XP Associate Expert
    >> >--
    >> >More people read the newsgroups than read my email.
    >> >Reply to the newsgroup for a faster response.
    >> >(Control-G using Outlook Express)
    >> >--
    >> >
    >> >"Manuel Lopez" <> wrote in message
    >> >news:...
    >> >> Hello,
    >> >>
    >> >> I have a Web Project (UserControls.dll) with some

    user
    >> controls that
    >> >> is shared by many asp.net web applicattions.
    >> >>
    >> >> What we do is copy UserControls.dll to all the

    >> applications bin
    >> >> folders an this works correctly.
    >> >>
    >> >> We want to have this shared code in the GAC.
    >> >>
    >> >> Wit other non-web projects we create a snk file, add

    it
    >> to the project
    >> >> and compile. Later we register this dll manually in

    the
    >> GAC.
    >> >>
    >> >> I have been trying to do this with a web project ,

    and
    >> all the time I
    >> >> get an error saying that it cannot read the snk file.
    >> >>
    >> >> Is it possible to strong name the generated dll of a

    >> web project?
    >> >>
    >> >> Thanks in Advance.
    >> >>
    >> >> Manuel
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >
    Chris Jackson, Dec 2, 2003
    #6
  7. I guess I should point out, for the sake of completeness, that this may not
    be the best idea. The reason I have strong named ASP.NET assemblies is
    basically just to see if it can be done. (Well, FXCop was barking...)
    However, note that the model for ASP.NET is not *complete* compilation, but
    rather compilation of the code behind, followed by JIT compilation of the
    declarative ASPX page. So, your derived forms won't actually exist in the
    strong named assembly. What you should consider is developing a class
    library of classes that derive from the UserControl class to provide the
    basic functionality that you need, and then provide declarative pages whose
    code behind inherits from this. This just occurred to me, so I figured I
    would add this appendix...

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows Client
    Windows XP Associate Expert
    --
    More people read the newsgroups than read my email.
    Reply to the newsgroup for a faster response.
    (Control-G using Outlook Express)
    --

    "Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
    news:%23RN%...
    > You can strong name it, you just have to manually drag the SNK file to the
    > VSWebCache folder (as indicated in my first post). VS.NET does not provide
    > the mechanisms, though the error message should help you locate the proper
    > directory. The folder in inetpub is NOT where it goes. I have done it
    > before, I just don't have any on this machine to give you the exact
    > location, but I promise you that it works.
    >
    > --
    > Chris Jackson
    > Software Engineer
    > Microsoft MVP - Windows Client
    > Windows XP Associate Expert
    > --
    > More people read the newsgroups than read my email.
    > Reply to the newsgroup for a faster response.
    > (Control-G using Outlook Express)
    > --
    >
    > "Manuel Lopez" <> wrote in message
    > news:afa901c3b8b6$b56a0a10$...
    > Hello Again Chris,
    >
    > My problem is that i can´t generate the strong name "web"
    > project.
    >
    > The snk file is the at the same level of of vbproj file,
    > and in assembly i have :
    >
    > <Assembly: AssemblyKeyFile("..\..\Keys.snk")>
    >
    > I have tried copying the snk file to the bin directory,
    > changing the path and it just doesn´t work for a "Web"
    > project.
    >
    > Maybe you just can´t strong name a "Web" through Visual
    > Studio.
    >
    > Thanks
    >
    > >-----Original Message-----
    > >I may be missing what you are asking here. Are you trying

    > to compile the
    > >project you are strong naming and failing? If that is the

    > case, then you
    > >need to move the SNK file. The error that is generated

    > should tell you the
    > >directory it is searching in and failing to find it. Have

    > you compiled and
    > >strong named an assembly, and having trouble referencing

    > it? You should
    > >definitely be able to reference a strong named file -

    > that also works. You
    > >just need to make sure it is in the search path. What is

    > the error that you
    > >are seeing?
    > >
    > >--
    > >Chris Jackson
    > >Software Engineer
    > >Microsoft MVP - Windows Client
    > >Windows XP Associate Expert
    > >--
    > >More people read the newsgroups than read my email.
    > >Reply to the newsgroup for a faster response.
    > >(Control-G using Outlook Express)
    > >--
    > >
    > >"Manuel Lopez" <>

    > wrote in message
    > >news:0ae201c3b833$8a338160$...
    > >> Hello Chris,
    > >>
    > >> Thanks for the reply.
    > >>
    > >> Our problem is that we cannot compile our web project

    > with
    > >> the user controls when we add a snk file and reference

    > it
    > >> from Assembly file.
    > >>
    > >> It seems as if you cannot use then with web projects.
    > >>
    > >>
    > >> >-----Original Message-----
    > >> >Yes it is, but with ASP.NET there are two places where

    > a
    > >> binary is built.
    > >> >You may have to put the strong name in the temporary
    > >> directory where things
    > >> >are built:
    > >> >
    > >> >c:\documents and
    > >>

    > >settings\<userName>\VSWebCache\<machineName>\<applicationN
    > >> ame>
    > >> >
    > >> >
    > >> >--
    > >> >Chris Jackson
    > >> >Software Engineer
    > >> >Microsoft MVP - Windows Client
    > >> >Windows XP Associate Expert
    > >> >--
    > >> >More people read the newsgroups than read my email.
    > >> >Reply to the newsgroup for a faster response.
    > >> >(Control-G using Outlook Express)
    > >> >--
    > >> >
    > >> >"Manuel Lopez" <> wrote in message
    > >> >news:...
    > >> >> Hello,
    > >> >>
    > >> >> I have a Web Project (UserControls.dll) with some

    > user
    > >> controls that
    > >> >> is shared by many asp.net web applicattions.
    > >> >>
    > >> >> What we do is copy UserControls.dll to all the
    > >> applications bin
    > >> >> folders an this works correctly.
    > >> >>
    > >> >> We want to have this shared code in the GAC.
    > >> >>
    > >> >> Wit other non-web projects we create a snk file, add

    > it
    > >> to the project
    > >> >> and compile. Later we register this dll manually in

    > the
    > >> GAC.
    > >> >>
    > >> >> I have been trying to do this with a web project ,

    > and
    > >> all the time I
    > >> >> get an error saying that it cannot read the snk file.
    > >> >>
    > >> >> Is it possible to strong name the generated dll of a
    > >> web project?
    > >> >>
    > >> >> Thanks in Advance.
    > >> >>
    > >> >> Manuel
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >

    >
    >
    Chris Jackson, Dec 2, 2003
    #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. rob

    VB6 to VB.NET & Strong Naming

    rob, Apr 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,340
    =?Utf-8?B?Qm9uag==?=
    Apr 28, 2004
  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. Sachin Patil

    Strong Naming Fails for .NET 2.0

    Sachin Patil, Jun 6, 2006, in forum: ASP .Net Security
    Replies:
    1
    Views:
    212
    Nicole Calinoiu
    Jun 7, 2006
Loading...

Share This Page