0

The task is that the contents of the dll file becomes known only during the execution of the main program, in which I get the necessary data and form a line or cs file. Then I need to create a dll from the code I wrote in the line (let's say it's correct and compiles without errors). Then I will dynamically connect this dll to the main program and use the function from there.

The main problem is in the dynamic creation of the dll file, I did not find a working option. I am working in WPF .NET 5.0, I tried CodeDOM but there was an error "not supported on this version" so I will be very grateful for any information on how to do it!

  • 2
    You can use [Roslyn](https://learn.microsoft.com/en-us/archive/msdn-magazine/2017/may/net-core-cross-platform-code-generation-with-roslyn-and-net-core#executing-code-the-emit-apis). – Guru Stron Jan 03 '22 at 21:06
  • See [Is it possible to dynamically compile and execute C# code fragments?](https://stackoverflow.com/questions/826398/is-it-possible-to-dynamically-compile-and-execute-c-sharp-code-fragments), – JonasH Jan 04 '22 at 07:59

0 Answers0