I have a current assembly in my application and I would like to add a class from external cs file into this assembly. Is it possible to do it? I would like to use it like plug-ins. Now I'm trying use:
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
and Activator,but without success. My application is using Roslyn, so maybe it can do it. Any idea will be appreciated.
Edit: Next problem with it is: Can I use external file (cs file with class) to get instance from this file but the constructor of class needs reference to sceneManager from current assembley. So is possible to send a reference to Roslyn of something like that and get instance of class from it?
You cannot modify an existing assembly that has already been loaded.
Instead, you can compile code to a new assembly (using Roslyn, CodeDOM, Sigil, or similar libraries) and load that assembly using reflection.