How to refer to console application projects in .NET Core 3.0
I have created 2 console projects using .NET Core 3.0 and I have removed program.cs file in the 2nd project and add that project as a reference project to 1st one.
While compiling, I am getting the error "Program does not contain a static 'Main' method suitable for an entry point".
Can anyone explain the how the referencing 2 projects works in C#?
The entry-point (aka Main
) needs to exist in any console project (i.e. an exe). Normally in this scenario you would have:
- some library project
- (has some code)
- some console project
- references "some library project"
- has an entry-point (
Main
) - (probably has some other code)
It sounds like you just want to make the first project a library project rather than a console project, which can be done by removing <OutputType>Exe</OutputType>
from the csproj.