Hello,

I have Assembly (A) which dynamically loads Asembly (B). Both Assemblies are
located in A's bin dir.

If I query, AppDomain.CurrentDomain.GetAssemblies

Returns an unloaded/unreferenced assembly (B) why? Assembly A does not
refernce any types in B. Is there a way to prevent this assembly from loading
on startup?

RE: Dynamic Assembly by NoSpamMgbworld

NoSpamMgbworld
Fri Jan 07 08:01:03 CST 2005

As long as the assembly is in the app path, it will be queried by your app,
even if it is never used. If you want to get around this, hide the assembly
and use Reflection to dynamically load it. If you want to go to the nth with
dynamic loading, you can store the assembly as code and gen it at runtime
with Reflection.Emit. The source will not show up as an unloaded assembly,
even if you smack it in the /bin folder.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


"BrianS" wrote:

> Hello,
>
> I have Assembly (A) which dynamically loads Asembly (B). Both Assemblies are
> located in A's bin dir.
>
> If I query, AppDomain.CurrentDomain.GetAssemblies
>
> Returns an unloaded/unreferenced assembly (B) why? Assembly A does not
> refernce any types in B. Is there a way to prevent this assembly from loading
> on startup?
>

RE: Dynamic Assembly by BrianS

BrianS
Fri Jan 07 08:55:03 CST 2005

What is the correct way to "hide" the assembly. I set the file attribute to
hidden, but It still is loading the assembly.

"Cowboy (Gregory A. Beamer) - MVP" wrote:

> As long as the assembly is in the app path, it will be queried by your app,
> even if it is never used. If you want to get around this, hide the assembly
> and use Reflection to dynamically load it. If you want to go to the nth with
> dynamic loading, you can store the assembly as code and gen it at runtime
> with Reflection.Emit. The source will not show up as an unloaded assembly,
> even if you smack it in the /bin folder.
>
> ---
>
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
>
> "BrianS" wrote:
>
> > Hello,
> >
> > I have Assembly (A) which dynamically loads Asembly (B). Both Assemblies are
> > located in A's bin dir.
> >
> > If I query, AppDomain.CurrentDomain.GetAssemblies
> >
> > Returns an unloaded/unreferenced assembly (B) why? Assembly A does not
> > refernce any types in B. Is there a way to prevent this assembly from loading
> > on startup?
> >