Use AssemblyBuilder.DefineDynamicAssembly

Proprietary

Replace dynamic assembly creation on AppDomain.CurrentDomain or Thread.GetDomain() with the static AssemblyBuilder.DefineDynamicAssembly API supported by .NET Core. Only the two-argument overload with Run or RunAndCollect access is transformed. Single-use method-local access flags initialized to those values are also supported. Other domains, persistence modes, unresolved calls and shared calls outside conditional regions require review.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UseAssemblyBuilderDefineDynamicAssembly
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UseAssemblyBuilderDefineDynamicAssembly

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.