Skip to the content.

Dapper.AOT runs on interceptors, which requires at least C# 11. The language version is implied by your target .NET version, but can be changed manually - it is fine to use a different language version than the default for that target runtime, especially when going “higher”. For example, you can use C# 12 on a project that targets .NET Framework (as long as you have up-to-date build tools).

The easiest way to do this is via <LangVersion>latest</LangVersion>.

For more information, see https://learn.microsoft.com/dotnet/csharp/language-reference/configure-language-version