Hi,
You can use CAS.
Sign all of your assemblies with the same strong-name, then Demand the
StrongNameIdent ityPermissionAt tribute attribute on your public, static
methods with your assembly signature's public key so they cannot be called
from other assemblies.
The PublicKey value must be a hexadecimal string. You can use the Strong
Name utility (sn.exe) to create the key with which you'll sign your assembly
(although Visual Studio can be used to perform this operation for you).
The -k switch will create the public/private key pair. If you use -k to
create a file named, "key.snk" then use that file as input to the -p switch.
The file output from the -p switch can then be used as input to the -tp
switch to produce the hexadecimal representation of the public key that you
can assign to the PublicKey property of the
StrongNameIdent ityPermissionAt tribute attribute. Make sure you use the full
public key and not just the token.
--
Dave Sexton
http://davesexton.com/blog http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)
"Dan Holmes" <da*******@bigf oot.comwrote in message
news:Oj******** ******@TK2MSFTN GP03.phx.gbl...
>I have assembly a, b and c. Assembly b has a static method in one of its
classes that i would like classes in a and c to access but no other
assembly.
It would be similar to internal but with the ability to specify which
classes could access this method.
I know this doesn't exist but a declaration like:
[InternalTo(A.dl l, C.dll)]
internal static Method()...
I guess i could check the call stack in Method for callers that are at the
top of the stack are a.dll or c.dll. Is there a better way?
dan