Friend assemblies change post .Net framework 2.0 beta1

For introduction of friend assemblies please read my blog

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 (10)
  1. James says:

    Is it possible to have a web project as a friend assembly?

  2. Kevin Dente says:

    Why was restriction #1 added?

  3. James,

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


    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.

  4. Kevin Dente says:

    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?

  5. Kevin Dente says:

    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.

  6. It is so that you don’t accidentally open yourself to the world.

  7. James says:

    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?

  8. James,

    I see. I don’t know the answer then.

Comments are closed.

Skip to main content