Visual Studio Code: “Program has more than one entry point defined”

前端 未结 1 1403
别那么骄傲
别那么骄傲 2020-12-16 03:19

I created a C# project using Visual Studio Code. This project contains two .cs files, Addition.cs and Substraction.cs. Both files contain a main()

相关标签:
1条回答
  • 2020-12-16 04:11

    If both entry points are in the same project, setting the startup project wouldn't do anything anyway. You need to set the startup object.

    This can be done in the project properties dialog in a full version of Visual Studio (look for "Startup object" under Application), or in the .csproj file by setting Project/PropertyGroup/StartupObject:

    <StartupObject>Example.Addition</StartupObject>
    

    Alternatively consider using a single Main() entry point which takes a command-line argument.

    0 讨论(0)
提交回复
热议问题