title: Why can't I use STAThread attribute in C++/CLI?
body: <p>I wan to use the STAThread attribute on my the main thread of my program. However, Visual Studio says it cannot find it. I have tried references necessary assemblies and using proper namespace, but it just can't find it.</p>
  
  <p>Edit:</p>
  
  <p>I have been able to get to work successfully after manually creating a thread with the 
  ApartmentState to STA. I think this is the equivalent to setting the thread, be it the main thread, but not exactly because i'm creating another thread. Anyone have another way to do this. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>void threadStart ()
  {
      Application::Run (gcnew GraphicsForm());
  }
  [System::STAThread] // This will not work!
  int main(array&lt;System::String ^&gt; ^args)
  {
      Thread ^t = gcnew Thread(gcnew ThreadStart (threadStart));
      t-&gt;ApartmentState = ApartmentState::STA;
      t-&gt;Start();
      return 0;
  }
  </code></pre>