title: How do I add System.Windows.Forms to my .NET 5.0 project?
body: <p>I apologize ahead of time for my lack of terminology and understanding, I am very new to .NET and Visual Studio.</p>
  <p>I am on Windows 7 64 Bit in Visual Studio Community 2019 Version 16.10.4 making a Console Application for .NET 5.0 using Visual Basic.</p>
  <p>I am trying to use the Windows.Forms.Form object and make a little window pop-up and ask the user to select an item from a ListBox. But so far I have not been successful in adding System.Windows.Forms to my project.</p>
  <p>I tried <code>Imports System.Windows.Forms</code> but that gave the warning &quot;Namespace or type specified in the Imports 'System.Windows.Forms' doesn't contain any public member or cannot be found.&quot;.</p>
  <p>I went to Project -&gt; Add COM Reference -&gt; &quot;System_Windows_Forms&quot; (Version 2.0)</p>
  <p>That reference has a warning: &quot;Failed to create the wrapper assembly for type library {215d64d2-031c-33c7-96e3-61794cd1ee61}. Type library 'System_Windows_Forms' was exported from a CLR assembly and cannot be re-imported as a CLR assembly.&quot;</p>
  <p>I heard that adding the .dll directly can fix that, so I removed the COM reference and  went to Project -&gt; Add Project Reference -&gt; Browse -&gt; &quot;C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Windows.Forms.dll&quot;</p>
  <p>When I searched for Forms.dll I found about 10 files so I just picked the one that looked most correct. After that, I could use the objects in my script and Visual Studio could autocomplete the properties and functions of the objects. But when I actually went into the debugger and tried to run the script, I get the error:</p>
  <blockquote>
  <p>System.IO.FileNotFoundException<br />
  HResult=0x80070002<br />
  Message=Could not load file or assembly 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.<br />
  Source=System.Windows.Forms<br />
  StackTrace:<br />
  at System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext)<br />
  at System.Windows.Forms.Control..ctor()<br />
  at System.Windows.Forms.ListControl..ctor()<br />
  at System.Windows.Forms.ListBox..ctor()<br />
  at GetNovel.Program.DetermineNovel()</p>
  </blockquote>
  <p>Here is my sub that causes the error:</p>
  <pre><code>Sub DetermineNovel()
      Dim Novels As Object = {{&quot;Moon's Labyrinth&quot;, &quot;ML&quot;, True, 262, 362}, {&quot;Keyboard Immortal&quot;, &quot;KI&quot;, False, 254, 254}}
  
      Dim SelectBox As New Windows.Forms.ListBox
      Dim i As Long
      For i = LBound(Novels) To UBound(Novels)
          SelectBox.Items.Add(Novels(i, 0))
      Next i
  
      Dim NovelSelect As New Windows.Forms.Form
      NovelSelect.Controls.Add(SelectBox)
      NovelSelect.Text = &quot;Select Novel:&quot;
  
      NovelSelect.Show()
  End Sub
  </code></pre>