If you get an error message you don;t understand, start by passing it to Google:
Google "Current thread must be set to ... is attached to the process"[
^]
It's very likely that whatever message you have, has been met, explained, and fixed many times before - as is the case here.
Follow some of the links and see what they say. Or in this case, do exactly what the error message tells you to do, and apply the STAThreadAttribute to your Main function:
static class Program
{
[STAThread]
static void Main()
{
...
}
}