title: Ensuring an assembly is called via a specified assembly
body: <p>Is there any built in functionality to determine if an assembly is being called from a particular assembly?</p>
  
  <p>I have assembly <code>A</code> which references assembly <code>B</code>.  Assembly <code>A</code> exposes PowerShell cmdlets and outputs types that are found within <code>B</code>. Certain methods and properties with in types of exposed by <code>B</code> are of interest to types in assembly <code>A</code> but not of interest to consumers of PowerShell or anyone attempting to load types in <code>B</code> directly and call methods within it.</p>
  
  <p>I have looked into <code>InternalsVisibleToAttribute</code> 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. </p>
  
  <p>Is there any way to ensure <code>B</code> is called only by <code>A</code>?</p>