KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a CompilerParameters object that I use to feed a Microsoft.CSharp.CSharpCodeProvider object and an ICodeCompiler object that derives from that. Everything works OK, and I can compile code on the fly. My problem is with the referenced assemblies. Right now, I just add all assemblies from System.Reflection.Assembly.GetExecutingAssembly().GetReferencedAssemblies() into the compiler parameter's ReferencedAssemblies . This works for files on the hard disk. However I have one assembly that is in memory and not on the disk. When I try to reference it, I get a FileNotFoundException which I expect since it is trying to add a path that doesn't exist. So how do I pass in an actual Assembly object to CompilerParameters.ReferencedAssemblies ? I have seen a few posts online from 2006 and before that say it is simply not possible. I am hoping with .net 3.5 and .net 4.0 the support for this sort of thing has been added, but I am unsure. FYI, I am using .NET 4.0 Also, right now I am creating a temporary file from the byte[] in program space, then loading that file into an assembly. I know the compiler does this in the background, but it also cleans up after itself I believe. It would be great if I could do: CompilerParameters.ReferencedAssemblies.Add(Assembly a)
Tags (comma-separated)
Save Edits
Cancel