I have one assembly that's created already, say Static.dll
, and a dynamic assembly I'm creating at runtime, say Dynamic
. Dynamic
creates some IL code to create a new type from Static.dll
. When Dynamic
is created (it saves successfully), the executable, when ran, errors out because it's unable to load the assembly Static.dll
type. I believe this is happening since the Dynamic
exe output can't find this dll (or at least this is my guess).
How can accomplish adding in this Static.dll
reference so that when someone runs the resulting executable output of Dynamic
that it can find the referenced types?
I know about Assembly.Load()
, but this alone doesn't change anything. Or at least, I'm not sure what this gives me since I don't need to use the type at runtime, but rather when running the Dynamic
executable.
Lastly, I control the Static.dll
, so if there is something I can do with the project to fix it, It could be done, however, it does need to remain separate (I don't want to Emit this library for every time I create a dynamic assembly). Basically, I think I want to have my dynamic assembly to have a .assembly extern mscorlib
in it's manifest save Static
is place of the mscorlib.
Thanks
The reference will be added automatically. Note that normal assembly-probing rules apply when your dynamic assembly executes, so in order to find the assembly. You must (one of):