Welcome to MSDN Blogs Sign in | Join | Help

Friend assemblies change post .Net framework 2.0 beta1

For introduction of friend assemblies please read my blog

http://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.

Published Friday, June 03, 2005 1:27 AM by junfeng
Filed under: ,

Comments

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 5:38 AM by James
Is it possible to have a web project as a friend assembly?

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 9:03 AM by Kevin Dente
Why was restriction #1 added?

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 11:06 AM by junfeng
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.

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 1:50 PM by Kevin Dente
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?

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 1:53 PM by Kevin Dente
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.

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 2:00 PM by junfeng
It is so that you don't accidentally open yourself to the world.

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 7:26 PM by James
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?

# re: Friend assemblies change post .Net framework 2.0 beta1

Friday, June 03, 2005 7:32 PM by junfeng
James,

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

# Whidbey Watcher #48: Friend assemblies (reloaded)

Monday, August 22, 2005 1:47 PM by Corrado's BLogs

# .net 2.0 : utilisation de internalsVisibleTo | hilpers

Thursday, January 22, 2009 10:48 AM by .net 2.0 : utilisation de internalsVisibleTo | hilpers
New Comments to this post are disabled
 
Page view tracker