Search code examples
asp.net-web-api

autofac container resolve getting "Dynamic code generation is not supported on this platform" error


I wanna get my dependencies dynamically on asp.net minimal api with this code

_userService = container.Resolve<IUserService>();

but i getting this error

Dynamic code generation is not supported on this platform

I tried change some configs of *.csproj


Solution

  • I found solution

    Delete this line in *.csproj

    <PublishAot>true</PublishAot>