Automatically adding dependents of an assembly to the project

  • Thread starter Thread starter E-ploko
  • Start date Start date
E

E-ploko

Hello all,

Here we have a large set of assemblies... about 250 lying around and
we have to reference them all in a project. Is there a way in
existence that'd allow us to somehow bundle them all together into a
single assembly, so when the assembly is referenced, all the
assemblies, that have been "bundled into it", get automatically
referenced in our project?

We use VS.NET 2005 and the .Net 2.0.

I've been digging this for a couple of days now and seem unable to
find the answer. Any hints or clues or whatever would be highly
appreciated.
 
Hi,

i do not know an automatic mechnism to do that, but a way to think about is
to register an assembly resolve event at the beginning of your code like:

AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(CurrentDomain_AssemblyResolve);

this event is raised when a dependant assembly is needed. in the handle you
can do something like this to load the assembly. But that way means you know
where to get your dependant assemblies from (location):

internal Assembly CurrentDomain_AssemblyResolve(object sender,
ResolveEventArgs args)
{
foreach (Assembly loadedAss in
AppDomain.CurrentDomain.GetAssemblies())
{
if (args.Name == loadedAss.FullName)
{
return loadedAss;
}
}

return null;
}
 
i do not know an automatic mechnism to do that, but a way to think about is
to register an assembly resolve event at the beginning of your code like:

Er... I forgot to say all those assemblies should be referenced at
design-time, so we get the IntelliSense magic working. The run-time
trick wouldn't help in that, I suppose. Thanks for pointing that out,
anyway.
 
Back
Top