title: Could not load file or assembly
body: <p>In my power shell script I am loading a custom assembly and then instantiating a class of that assembly by <code>New-Object</code>.</p>
  
  <p><code>Assembly.LoadFile()</code> executes successfully but <code>New-Object</code> statement gives the bellow exception.  </p>
  
  <pre><code>New-Object : Exception calling ".ctor" with "1" argument(s): "Could not load file or assembly 'MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of i
  ts dependencies. The system cannot find the file specified."
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>[System.Reflection.Assembly]::LoadFile("MyAssembly.dll")
  $a=New-Object MyAssembly.MyClass -ArgumentList "arg1"
  </code></pre>
  
  <p>This custom assembly references only the following assemblies</p>
  
  <pre><code>System
  System.Core
  System.Runtime.Serialization
  System.Xml.Linq
  System.Data
  System.Xml
  </code></pre>
  
  <p>I tried explicitly loading the System.Runtime.Serialization dll like below. But same exception </p>
  
  <pre><code>[System.Reflection.Assembly]::Load("System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
  </code></pre>
  
  <p>Any idea?</p>