Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

csproj is not using latest C# version in VS 2019

$
0
0

I had upgraded the solution/projects to VS 2019 & .NET Core in all projects to netcoreapp3.1 & netstandard1.2 .  When compiled WebApp csproj is still showing older version because of this compiler error message "Program does not contain a static Main method suitable for an entry point".  I'm using async which is now permitted in C# version 8 & up.  I even try LangVersion as latest or preview w/ no luck, I read documentation that we don't need to specify LangVersion starting with .NET Core 3.0 & up as it will be done automatically.  So what could be the problem here?

[ Program.cs ]

    public class Program

    {

        public async static void Main(string[] args)

        {

            await Host.CreateDefaultBuilder(args)

                .ConfigureWebHostDefaults(webBuilder => {

                    webBuilder.UseContentRoot(Directory.GetCurrentDirectory());

                    webBuilder.UseKestrel();

                    webBuilder.UseAzureAppServices();

                    webBuilder.UseStartup<Startup>();

                    //webBuilder.UseSerilog()

                })

            .ConfigureLogging((logging) =>

            {

                //logging.AddSerilog();

            })

            .Build()

            .RunAsync();

        }

    }

[ csproj ]

    <Project Sdk="Microsoft.NET.Sdk.Web">

      <PropertyGroup>

        <VersionPrefix>1.2.0</VersionPrefix>

        <OutputType>Exe</OutputType>

        <TargetFramework>netcoreapp3.1</TargetFramework>

        <PreserveCompilationContext>true</PreserveCompilationContext>

        <AssemblyName>ABCoA.Payments.CustomerWeb</AssemblyName>

        <PackageId>ABCoA.Payments.CustomerWeb</PackageId>

      </PropertyGroup>

      <PropertyGroup>

        <LangVersion>preview</LangVersion>

      </PropertyGroup>

    </Project>


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>