How would I add a dynamically loaded assembly as a reference to the CompilerParameters.RerencedAssemblies
collection? I know I can add a reference by Assembly.Location
, but my dynamically loaded assembly has no location. It is in the AppDomain though. But I cannot find a way to add it as a referenced assembly. Storing it in the GAC is no option.
I tried to serialize it to disk and then add it as a reference, but that fails miserably. (The serialized assembly is not a valid dll).
Any thoughts? (.Net 4.5)
BTW, this is a duplicate of this question, but it got no answers. And it's pretty old, so that's why I'm asking it again.