Share via


Friend assemblies change post .Net framework 2.0 beta1

For introduction of friend assemblies please read my blog

https://blogs.msdn.com/junfeng/archive/2004/07/23/192268.aspx

In .Net framework 2.0 beta2, some restrictions are added for friend assembly declaration.

1. Strongly named assembly can only have strongly named assemblies as its friend.
2. Only name and publicKeyToken/publicKey are allowed in friend assembly declaration. If you put any other name attributes(version/culture/processorArchitecture) in the display name, CLR will error out.

Post beta2 one more restriction is added.

Only name + publicKey combination is allowed. publicKeyToken is not allowed in friend assembly declaration.

Yes, you have to write super long friend assembly declaration now.

Comments

  • Anonymous
    June 02, 2005
    Is it possible to have a web project as a friend assembly?
  • Anonymous
    June 03, 2005
    Why was restriction #1 added?
  • Anonymous
    June 03, 2005
    James,

    Of course. Your web project eventually will be compiled into assemblies.

    Kevin,

    I thought restriction #1 makes perfect sense. If you allow strongly named assembly to have non-strongly name assemblies as friends, it pretty much means anyone can look at your internals, as long as they name their assemblies the same as your friend assembly.
  • Anonymous
    June 03, 2005
    Just to be clear, you're saying that an assembly can only be friend of another assembly if they have the SAME strong name key, right?
  • Anonymous
    June 03, 2005
    Sorry, ignore that last comment. I see that they wouldn't have to have the same key.

    While I see the value of supporting strong name assemblies as friends, I don't really understand why it's a requirement.
  • Anonymous
    June 03, 2005
    It is so that you don't accidentally open yourself to the world.
  • Anonymous
    June 03, 2005
    What I meant was is it possible for another assembly to declear a web project a friend so that the web project can access the other assembly's internal methods.

    If so, how do you do it? As far as I'm aware you can't give a web project an assembly name so how do you reference it?
  • Anonymous
    June 03, 2005
    James,

    I see. I don't know the answer then.
  • Anonymous
    January 22, 2009
    PingBack from http://www.hilpers.fr/962700-net-2-0-utilisation-de