I'm trying to make the Main
async, so I tried:
class Program
{
static async Task Main(string[] args)
{
Books books = new Books();
await books.AddBooksAsync();
}
}
where AddBooksAsync
have this structure:
public async Task AddBooksAsync()
{
//some contents
}
I get this error:
Does not contain a static 'main' method suitable for an entry point
Your visual studio by default will be setted to this Which means that the major version will be 7.0 and not 7.1 you should force it to 7.1 in order to compile it with the 7.1 version
The second option in Project Properties=> Build =>advanced set the language version to C# latest minor version(latest)
Add this in your csproj.
<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With