C
C
Chop1233212020-11-25 17:20:37
C++ / C#
Chop123321, 2020-11-25 17:20:37

How to fix error in c# CS0017 code?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MyFirstProgram
{
    class Program
    {
            static void Main(string[] args)
            {

            int x = 10;
            Console.WriteLine(x);
            Console.ReadKey();

            }
    }
}

Error CS0017 Multiple entry points defined for the program. Compiling with /main will allow you to specify the type containing the entry point.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
freeExec, 2020-11-25
@freeExec

Create a Console Application, Not a WindowsForm

V
Vasily Bannikov, 2020-11-25
@vabka

You have an extra static void Main() somewhere - I don't believe that's all the code you have in your project.
Find and delete.
PS: Why do you need a header from using System.Windows.* if it is not used?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question