Every time I try to use the code in the code editor for our textbook it says there is more than one entry point defined. But when I use it in Visual Studio it works perfectly fine.
using System;
using static System.Console;
using System.Globalization;
class ProjectedRaises
{
static void Main()
{
const double RAISE = .04;
string salaryAsString;
double salary;
double total;
Write("Enter employee salary: ");
salaryAsString = ReadLine();
salary = Convert.ToDouble(salaryAsString);
total = salary + (salary * RAISE);
WriteLine("Next year's salary for the first employee will be {0}",
total.ToString("C", CultureInfo.GetCultureInfo("en-US")));
}
}
It is the code editor for "Cengage MindTap Microsoft Visual C#" textbook. It provides all the stuff at the top and the Main and all the curly brackets. I just have to write the stuff in between. The code I posted is the whole thing that is in the window.
Every time I try to use the code in the code editor for our textbook it says there is more than one entry point defined. But when I use it in Visual Studio it works perfectly fine.
using System;
using static System.Console;
using System.Globalization;
class ProjectedRaises
{
static void Main()
{
const double RAISE = .04;
string salaryAsString;
double salary;
double total;
Write("Enter employee salary: ");
salaryAsString = ReadLine();
salary = Convert.ToDouble(salaryAsString);
total = salary + (salary * RAISE);
WriteLine("Next year's salary for the first employee will be {0}",
total.ToString("C", CultureInfo.GetCultureInfo("en-US")));
}
}
It is the code editor for "Cengage MindTap Microsoft Visual C#" textbook. It provides all the stuff at the top and the Main and all the curly brackets. I just have to write the stuff in between. The code I posted is the whole thing that is in the window.
Share Improve this question asked Feb 5 at 9:13 RLARLA 254 bronze badges 4 |1 Answer
Reset to default 0Your
static void Main()
is an entry point. You are being told there is another. So you will need to search for static void Main(
or Main(
in your Cengage MindTap Microsoft Visual C# textbook. If you don't find it, debug your application and see where it gets you first. That's the other entry point.
Of course, you will need to temporarily rename your Main
to Main2
for the time being to find the other entry point. Then adjust your main entry point with the content you intended to have inside your entry point.
Program.cs
somewhere that also has an entry-point? This could be a secondMain()
method, but it could also just be "top-level statements", for exampleConsole.WriteLine("Hello, World!");
not inside a type (that example is taken directly from the defaultProgram.cs
at the time of writing). The first thing I'd do here is renameMain
toMain2
so it compiles, run it, and see what happens; if I get a text console message: I'd search the code for that message. If this is caused by aProgram.cs
: presumably just delete that file. – Marc Gravell Commented Feb 5 at 10:26