Answer by Moondog 2112 for Does not contain a static 'main' method suitable...
For me, the error was actually produced by "Feature 'async main' is not available in C# 7.0. Please use language version 7.1 or greater". This issue was resulting in the "Does not contain a static...
View ArticleAnswer by Ali Jamal for Does not contain a static 'main' method suitable for...
Salaam, I have both Visual Studio 2017 and Visual Studio 2019 Visual Studio 2019 does not show this error but 2017 does. Try Installing Visual Studio 2019. Visual Studio 2017 Visual Studio 2019
View ArticleAnswer by Ali Ahmadi for Does not contain a static 'main' method suitable for...
I had this error and solved by this solution. --> Right click on the project --> and select "Properties" --> then set "Output Type" to "Class Library".
View ArticleAnswer by Manveer Singh for Does not contain a static 'main' method suitable...
If you are using a class library project then set Class Library as output type in properties under application section of project.
View ArticleAnswer by Peter Kindberg for Does not contain a static 'main' method suitable...
A valid entry looks like: public static class ConsoleProgram { [STAThread] static void Main() { Console.WriteLine("Got here"); Console.ReadLine(); } } I had issues as I'm writing a web application, but...
View ArticleAnswer by yash patel for Does not contain a static 'main' method suitable for...
hellow your main class was deleted so add new class that name set as Main.cs and pest that code or if porblem in window so same problem on that using System; using System.Collections.Generic; using...
View ArticleAnswer by Adam Cox for Does not contain a static 'main' method suitable for...
If you are like me, then you might have started with a Class Library, and then switched this to a Console Application. If so, change this... namespace ClassLibrary1 { public class Class1 { } } To...
View ArticleAnswer by Madison Haynie for Does not contain a static 'main' method suitable...
For some others coming here: In my case I had copied a .csproj from a sample project which included <EnableDefaultCompileItems>false</EnableDefaultCompileItems> without including the...
View ArticleAnswer by Gerrie Pretorius for Does not contain a static 'main' method...
When you want to allow paramaters to be specified from the command, they must look like this: [STAThread] static void Main(params string[] paramaters) { you cannot specify more than one paramater,...
View ArticleAnswer by James Wierzba for Does not contain a static 'main' method suitable...
Check to see if the project is set as the "Startup Project" Right click on the project and choose "Set as Startup Project" from the menu.
View ArticleAnswer by grumpy for Does not contain a static 'main' method suitable for an...
For future readers who faced same issue with Windows Forms Application, one solution is to add these lines to your main/start up form class: [STAThread] static void Main() {...
View ArticleAnswer by MaChaToc for Does not contain a static 'main' method suitable for...
I am using Visual Studio and also had this problem. It took me some time, but in my program it was caused because I accidentally deleted a Class named "Program" that is generated automatically.
View ArticleAnswer by Roman Volkov for Does not contain a static 'main' method suitable...
Select App.xaml and display its properties. Set Build Action to ApplicationDefinition. App.xaml and its corresponding *.cs file must be placed into the root directory of the *.csproj file, i. e. not...
View ArticleAnswer by Subrahmanya Prasad for Does not contain a static 'main' method...
I too have faced this problem. Then I realized that I was choosing Console Application(Package) rather than Console Application.
View ArticleAnswer by simonbs for Does not contain a static 'main' method suitable for an...
If you do have a Main method but still get this error, make sure that the file containing the Main method has "Build action" set to "Compile" and "Copy to ouput directory" set to "Do not copy".
View ArticleAnswer by Automationtested for Does not contain a static 'main' method...
Change the Output Type under the Project > Properties to that of a “Class Library”. By default, this setting may have been set to a “Console Application”.
View ArticleAnswer by Vimal Singh for Does not contain a static 'main' method suitable...
Simple Solution. 1.BUILD --> CLEAN PROJECT-NAME (it will clear your Previous not completed Build "it is Similar to refresh") 2.BUILD-->BUILD PROJECT-NAME. then you can simply start your Script it...
View ArticleAnswer by ROM for Does not contain a static 'main' method suitable for an...
If you don't have a file named Program.cs, just add a new Class and name it Program.cs. Then paste this code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using...
View ArticleAnswer by Chetan Soni for Does not contain a static 'main' method suitable...
hey i got same error and the solution to this error is just write Capital M instead of small m.. eg:- static void Main() I hope it helps..
View ArticleAnswer by eyossi for Does not contain a static 'main' method suitable for an...
Try adding this method to a class and see if you still get the error: [STAThread] static void Main() { }
View Article
More Pages to Explore .....