1

I'm working on a .NET 7 WPF application that relies on a .NET Framework (4.8.1) library that uses Reflection.Emit (with AssemblyBuilder.Save). When I call methods from that library from my application, it throws an exception complaining that it can't find the Reflection.Emit methods. Is there a way to start the .NET Framework methods in their own process, so they can access the required methods?

7
  • According to .NET Standard: if you want to share code between .NET Framework and any other .NET implementation, such as .NET Core, your library should target .NET Standard 2.0. Commented May 22, 2023 at 16:43
  • 1
    @Tudeschizieuinchid not sure that this will help in this case due to Reflection.Emit. Commented May 22, 2023 at 16:45
  • 4
    You can't start a method in a process, but you could write a .NET Framework application that uses the library as normal, and communicate with that using some form of IPC. Per Guru Stron though, you should first strongly consider finding an alternative for the library instead, as this certainly doesn't make things any easier. Commented May 22, 2023 at 16:52
  • 1
    BTW why do you need to generate assembly at runtime? TBH with source generators introduction it is much more rarely a correct approach. As for process options - the problem here that you will need to fire up a full .NET Framework app in a separate process and somehow manage inter-process communication. Commented May 22, 2023 at 16:54
  • 1
    @GuruStron I'm writing a compiler. I want to be able to save the compiled programs to the disk. Commented May 22, 2023 at 16:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.