none
Is there to tie assemblies together with a strong name key in .NET 4 RRS feed

  • Question

  • Hello,

    I would like only to allow callers with a specific strong name to access my assemblies. So is there a way in .NET 4 to demand a strong name between assemblies?

    Thanks

    Henrik.

    Thursday, August 26, 2010 12:31 PM

Answers

  • Unfortunately, there is no built-in mechanism for this, and there hasn't been since .NET 2.0 when fully trusted assemblies started passing all identity permission demands.  If you aren't willing to put up with publishing all your internals to fried assemblies, you'll either need to roll your own restriction mechanism or find a third-party solution.  (It may be possible to use a licensing approach for this.)  However, you should keep in mind that nothing you do will protect against deliberate bypass of the mechanism by fully trusted code.
    Thursday, August 26, 2010 1:03 PM

All replies

  • Have you considered using friend assemblies?  This is the "mainstream" mechanism for creating semi-public APIs.
    Thursday, August 26, 2010 12:46 PM
  • Yes, I have actually already tried that and it kind of works. But I would like internals to be internals for the assembly and public to be public for all "friend" assemblies. I am btw using C# if it matters.

    Thanks

    Henrik. 

    Thursday, August 26, 2010 12:51 PM
  • Unfortunately, there is no built-in mechanism for this, and there hasn't been since .NET 2.0 when fully trusted assemblies started passing all identity permission demands.  If you aren't willing to put up with publishing all your internals to fried assemblies, you'll either need to roll your own restriction mechanism or find a third-party solution.  (It may be possible to use a licensing approach for this.)  However, you should keep in mind that nothing you do will protect against deliberate bypass of the mechanism by fully trusted code.
    Thursday, August 26, 2010 1:03 PM
  • I think that I then will stick with the friendly assemblies. Thank you for your help.

    Thanks

    Henrik.

    Thursday, August 26, 2010 1:21 PM