title: Matlab failed to load a .NET assembly
body: <p>When I try to load in Matlab my .NET assembly foo.dll by typing:</p>
  
  <pre><code>asm = NET.addAssembly('fullpath\foo.dll');
  </code></pre>
  
  <p>I get the following error: "Could not load file or assembly 'file:///fullPath\foo.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Source: mscorlib HelpLink:"</p>
  
  <p>I've Matlab R2010a and I tried to build the assembly both for .NET framework 4.0 and .NET framework 3.0 with no success.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I did several tests and now maybe I've partly discovered the problem. In the above example I was trying to add a private assembly by giving the full path. I then remembered to have also previously registered the same assembly (targeted for .NET 4.0) in the GAC (through the <code>gacutil /i foo.dll</code> command). Hence I removed the assembly from the GAC (<code>gacutil /u foo</code>) and now at least I'm able to add the private assembly targeted for .NET 3.0 but still not if I want to target .NET 4.0. </p>
  
  <p>I presume that before, when I was trying to add a private assembly for .NET 3.0, Matlab was still trying to add the assembly for .NET 4.0 installed in the GAC, because of some conflict.
  However, I still do not understand why I cannot use .NET 4.0 .</p>