title: Powershell ISE to run custom dll method
body: <p>Hello I have been trying for long to run a method from a dll I created using the powershell ise.  Now I already run my dll from cmd by using 'dotnet foo.dll' but I would like to use the powershell as well.</p>
  
  <p>Here is my code:
  Program.cs</p>
  
  <pre><code>using System;
  
  namespace ConsoleApp1
  {
      public class Program
      { 
          public static void Main()
          {
              Console.WriteLine("Hello World!");
              Console.ReadKey();
          } 
      }
  }
  </code></pre>
  
  <p>Now I have created a new console app with the .net core framework in VS2017 Enterprise.  I only got a dll file after building no executable.  I have researched online and found how to load the dll file with <i>[Reflection.Assembly]::LoadFile("pathtofile")</i> btw LoadWithPartialName doesn't work for some reason.</p>
  
  <p>So after loading I try to invoke the Main method with <i>[ConsoleApp1.Program]::Main()</i> and i get this error</p>
  
  <pre><code>Unable to find type [ConsoleApp1.Program].
  At line:1 char:1
  + [ConsoleApp1.Program]::Main
  + ~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : InvalidOperation: (ConsoleApp1.Program:TypeName)    [], RuntimeException
  + FullyQualifiedErrorId : TypeNotFound
  </code></pre>
  
  <p>Please help me I can't find any solution to this for hours.</p>