I am using CSharpCodeProvider
to compile C# into a dynamic assembly which contains methods that are called by an external software.
Let's take the following code string that I am compiling dynamically:
public static class Foo
{
public static object Bar(a, b) {
return NameSpace.Type.Method(a, b); // Need to call original/compiling assembly
}
}
What I really want to do when calling NameSpace.Type.Method
, is to call a method inside the assembly that originally compiled the C# code (i.e. the one using the CSharpCodeProvider
).
That said, I cannot use ReferencedAssemblies.Add
to pass it into the CSharpCodeProvider
. This is because my assembly (DLL) is wrapped in such a way that it is dynamically loaded - i.e. it exists nowhere on the file system.
Is there any other way to call a method on the compiling assembly?
Aucun commentaire:
Enregistrer un commentaire