Is it possible to dynamically create an assembly that targets a different runtime from the current AppDomain.
For example, from within a .NET 4.0 application I want to create a new assembly that targets .NET 2.0 instead.
AssemblyBuilder builder = Thread.GetDomain().DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
var version = builder.ImageRuntimeVersion; //"v4.0.30319"
If it still needed I found the following example:
MSDN Blog- Targeting the .NET 2 Framework when using AssemblyBuilder under .NET 4
Seems like you have to use the CLR native API.
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