-1

I am moving into C# programming language and am creating a multi proyect solution. My problem is that I am using proyect1 in proyect2 and get the error that proyect1 supposedly requires a Main method when my entry program is in proyect2. Now, i set up my proyect2 as the start up proyect, made sure my solution is a single startup project and also referenced my proyect1 into proyect2 adequately.

If it helps, in proyect1 I have an abstrac class named Shape and another one that extends it named Square. I am trying to use square in proyect2. Proyect2 is referencing proyect1 but is asking for a main method in the proyect1. I tried rebooting my PC and didn't work either. If someone can point me through, it would be a great help.

Chris
  • 1
  • 1

1 Answers1

0

You need an entry point if your target is not a library. Even if it is not the startup project, it might be run using another project and so it needs a place to start from.

From C# specs:

When C# programs are compiled, they are physically packaged into assemblies. Assemblies typically have the file extension .exe or .dll, depending on whether they implement applications or libraries.

By convention, a static method named Main serves as the entry point of a program

Zein Makki
  • 29,485
  • 6
  • 52
  • 63