title: Referencing assemblies inside PS classes causes "Unable to find type" error
body: <p>I am using PowerShell 5.1 on a Windows 7 box and am trying to reference a type in a .NET assembly from inside a PowerShell class, and am getting an "Unable to find type" error.</p>
  
  <p>My "main" program is FooProg.ps1, where I am creating a new instance of the FooMod class</p>
  
  <pre><code>#Requires -Version 5.1
  using module .\FooMod\FooMod.psm1
  [FooMod]::new() | out-null
  </code></pre>
  
  <p>The FooMod class is in a PowerShell module (FooMod.psm1) in the FooMod sub-folder</p>
  
  <pre><code>#Requires -Version 5.1
  
  using assembly .\Foo.dll
  using namespace Foo
  
  class FooMod {
     FooMod() {
        Write-Host "Start - Assembly access"
        [Bar] $bar = [Bar]::new()
        Write-Host $bar.Name
        Write-Host $bar.Greeting()
        Write-Host "Finish - Assembly access"
     }
  }
  </code></pre>
  
  <p>My Foo.dll is built from the following Bar.cs, and is in the FooMod sub-folder along with the Module file (FooMod.psm1) and the Module Manifest file (FooMod.psd1)</p>
  
  <pre><code>namespace Foo {
     public class Bar {
        public string Name;
  
        public Bar(string name) =&gt; this.Name = name;
  
        public Bar() : this("Bar") {
        }
  
        public string Greeting() {
           return System.String.Format("Hello! My name is {0}", Name);
        }
     }
  }
  </code></pre>
  
  <p>I also have a Module Manifest in the FooMod sub-folder called FooMod.psd1 which contains these relevant entries</p>
  
  <pre><code>RootModule = 'FooMod.psm1'
  RequiredAssemblies = 'Foo.dll'
  </code></pre>
  
  <p>Is there anything else I am missing? Using the assembly outside the class works fine, instantiating a PowerShell class (without referencing an assembly / external type) works fine - but combining PowerShell classes and assembly types is a no-go!</p>