title: Build .NET Core 2.0 EXE file with C# 7.1
body: <p>I have a project I'm trying to build. It's using C# 7.1 features, and I can run it via Visual Studio, but when I try to publish to get an .exe file I get the error:</p>
  
  <pre><code>Agent.cs(8,30): error CS8107: Feature 'async main' is not available in C# 7.
  Please use language version 7.1 or greater. [C:\Users\stuarts\Documents\Visual
  Studio 2017\Projects\Agent\Agent\Agent.csproj]
  CSC : error CS5001: Program does not contain a static 'Main' method suitable
  for an entry point [C:\Users\stuarts\Documents\Visual Studio
  2017\Projects\Agent\Agent\Agent.csproj]
  </code></pre>
  
  <p>The .csproj (project) file:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;OutputType&gt;WinExe&lt;/OutputType&gt;
      &lt;TargetFramework&gt;netcoreapp2.0&lt;/TargetFramework&gt;
      &lt;IsPackable&gt;false&lt;/IsPackable&gt;
      &lt;NetStandardImplicitPackageVersion&gt;1.6.1&lt;/NetStandardImplicitPackageVersion&gt;
      &lt;RuntimeFrameworkVersion&gt;2.0.0-*&lt;/RuntimeFrameworkVersion&gt;
      &lt;RuntimeIdentifier&gt;win10-x64&lt;/RuntimeIdentifier&gt;
      &lt;ApplicationIcon /&gt;
      &lt;StartupObject /&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"&gt;
      &lt;LangVersion&gt;7.1&lt;/LangVersion&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="RabbitMQ.Client" Version="5.0.1" /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>
  
  <p>I'm building with:</p>
  
  <pre><code>dotnet publish -c Release -r win10-x64 Agent.csproj
  </code></pre>
  
  <p>Again, this all works when debugging in Visual Studio. Why is getting a simple .exe file out of a console application project template so awkward!</p>