My MS Visual C# program was compiling and running just fine. I close MS Visual C# to go off and do other things in life.
I reopen it and (before doing anything else)
I had this error and solved by this solution.
--> Right click on the project --> and select "Properties" --> then set "Output Type" to "Class Library".