Program does not contain a static 'Main' method suitable for an entry point

Ian's Avatar

Ian

02 Jun, 2018 11:56 AM

Hi,

I'm trying to build a project which is using a C# 7.2 feature (namely a console app with an async Main() method). It compiles and runs ok on my machine, but in AppVeyor it won't build and I get the error in the title:

Program does not contain a static 'Main' method suitable for an entry point

The language version is set to Latest for both Debug and Release configurations and the Build Worker Image is set to Visual Studio 2017 in AppVeyor.

Is this supported? And if so, what am I missing?

Thanks
Ian

  1. 1 Posted by seandhunt_7 on 02 Jun, 2018 05:04 PM

    seandhunt_7's Avatar

    I am afraid that AppVeyor might not support it yet for some reason.

  2. Support Staff 2 Posted by Owen McDonnell on 03 Jun, 2018 04:32 AM

    Owen McDonnell's Avatar

    What if you explicitly set the compiler version in your csproj file?

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
      <LangVersion>7.2</LangVersion>
    </PropertyGroup>
    
  3. Support Staff 3 Posted by Ilya Finkelshte... on 03 Jun, 2018 06:10 AM

    Ilya Finkelshteyn's Avatar

    Both latest and 7.2 should work. Just double-checked it with building this sample.

    sample builds:

    if this still does not work for you, share your .csproj file.

  4. 4 Posted by Ian on 03 Jun, 2018 11:26 AM

    Ian's Avatar

    Explicitly setting the language version to 7.2 worked, even though Latest didn't.

    Thanks for the help.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac