Terry
Member
- Joined
- Aug 19, 2014
- Messages
- 13
- Programming Experience
- 3-5
While I am waiting for a reply to my previous post I thought I'd write another... Does anyone know of a good reference to explain how to convert a single Module or procedure which is currently embedded within an application and convert it to a DLL programmatically. Through Visual Studio this is really easy, but I want to be able to do this at Run-Time. I have spent all day searching through many references which answer similar, but not this specific question. For instance, there is a reference (below) that shows how to do this "on the fly" and keep the code in memory. However, I want to be able to write it to a DLL for later access and execution. In this article below the compiled code ends up in a results object of type System.CodeDom.Compiler.CompilerResults but this contains just one line of code along with some other useful stuff.
Compiling .NET code on-the-fly - CodeProject
I had thought that generating a loop populating a List with lines of code using this approach might be the right way forward, but I also found that if you set the assembly name to something like an output assembly name of form ***.dll it was rejected even when the path name was correct. In other words it's not even clear if the intention is to have a shell output file here or just a pointer to where a file will be created. Either way this failed. So I am running out of steam on this one.
In any case, if anyone can answer the simple question of how to programatically convert a source Module to a DLL programatically that's all I need to know.
Many thanks
Compiling .NET code on-the-fly - CodeProject
I had thought that generating a loop populating a List with lines of code using this approach might be the right way forward, but I also found that if you set the assembly name to something like an output assembly name of form ***.dll it was rejected even when the path name was correct. In other words it's not even clear if the intention is to have a shell output file here or just a pointer to where a file will be created. Either way this failed. So I am running out of steam on this one.
In any case, if anyone can answer the simple question of how to programatically convert a source Module to a DLL programatically that's all I need to know.
Many thanks