title: Difficult loading Spectre.Console .NET typed classes in Powershell
body: <p>I'm trying to use the excellent <a href="https://spectreconsole.net/" rel="nofollow noreferrer">Spectre.Console</a> to create nice interactive prompts in powershell. So far I can get a simple Read-Host equivalent to work using the below:</p>
  <pre class="lang-powershell prettyprint-override"><code>Add-Type -AssemblyName &quot;.\path\to\Spectre.Console.dll&quot;
  [Spectre.Console.AnsiConsole]::Ask(&quot;Test Ask&quot;,&quot;Test Default&quot;)
  </code></pre>
  <p>Which will produce:</p>
  <pre class="lang-powershell prettyprint-override"><code>Test Ask (Test Default): Test 123
  Test 123
  </code></pre>
  <p>But when I try to access a &quot;typed&quot; class like so:</p>
  <pre class="lang-powershell prettyprint-override"><code>$select = [Spectre.Console.SelectionPrompt]
  </code></pre>
  <p>I get the error:</p>
  <pre class="lang-powershell prettyprint-override"><code>InvalidOperation: C:\path\to\proj\testing.ps1:7:11
  Line |
     7 |  $select = [Spectre.Console.SelectionPrompt]
       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       | Unable to find type [Spectre.Console.SelectionPrompt].
  </code></pre>
  <p>Looking at the <a href="https://spectreconsole.net/api/spectre.console/selectionprompt_1/" rel="nofollow noreferrer">Spectre</a> docs I can see that the class requires a return type , so I presume it's failing to find the class because I can't quite figure out how to provide it with a type in Posh.
  I've tried some variations such as adding ::New(),::Prompt() and prepending the object with [string], but it always fails to find the type.</p>
  <p>I'm able to get the equivalent working in C# without issue, but if possible I'd like to avoid having to write a wrapper class just to get it going in Posh.</p>
  <pre class="lang-powershell prettyprint-override"><code>Name                           Value
  ----                           -----
  PSVersion                      7.2.5
  PSEdition                      Core
  GitCommitId                    7.2.5
  OS                             Microsoft Windows 10.0.19043
  Platform                       Win32NT
  PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
  PSRemotingProtocolVersion      2.3
  SerializationVersion           1.1.0.1
  WSManStackVersion              3.0
  </code></pre>