C# - Ensuring an assembly is called via a specified assembly

Posted by Adam Driscoll on Stack Overflow See other posts from Stack Overflow or by Adam Driscoll
Published on 2010-05-17T21:06:01Z Indexed on 2010/05/17 21:10 UTC
Read the original article Hit count: 195

Filed under:
|
|
|

Is there any built in functionality to determine if an assembly is being called from a particular assembly?

I have assembly A which references assembly B. Assembly A exposes PowerShell cmdlets and outputs types that are found within B. Certain methods and properties with in types of exposed by B are of interest to types in assembly A but not of interest to consumers of PowerShell or anyone attempting to load types in B directly and call methods within it.

I have looked into InternalsVisibleToAttribute but it would require extensive rework because of the use of interfaces. I was devising a shared key system that would later be obfuscated but that seemed clunky.

Is there any way to ensure B is called only by A?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#