Click here to Skip to main content
15,890,741 members
Home / Discussions / C#
   

C#

 
GeneralMagic UI Tab control help Pin
Daniel Bright20-Jan-03 4:52
Daniel Bright20-Jan-03 4:52 
GeneralRe: Magic UI Tab control help Pin
Heath Stewart20-Jan-03 5:31
protectorHeath Stewart20-Jan-03 5:31 
GeneralRe: Magic UI Tab control help Pin
Daniel Bright20-Jan-03 5:52
Daniel Bright20-Jan-03 5:52 
General:mad: Parent/Child Pin
BadDude20-Jan-03 4:14
BadDude20-Jan-03 4:14 
GeneralRe: :mad: Parent/Child Pin
Heath Stewart20-Jan-03 5:36
protectorHeath Stewart20-Jan-03 5:36 
GeneralQuestion about organization Pin
xdavidx19-Jan-03 20:59
xdavidx19-Jan-03 20:59 
GeneralRe: Question about organization Pin
SimonS20-Jan-03 2:21
SimonS20-Jan-03 2:21 
GeneralSmart Client automatically loading ALL assemblies Pin
Ingram Leedy19-Jan-03 20:30
Ingram Leedy19-Jan-03 20:30 
Am building a bootstrapper/app loader that is basicaly a stub that gets an
assembly from a URL, like http://remotehost/code/startup.dll.

I want to iterate thru all the dependancies behind startup.dll and pre-load em (reason is to use in the install to pre-load large assemblies, or to provide some nice dialog progress when loading)

The problem is that some dependencies are in the GAC and others are located
on the webserver. Using assembly.load finds all the GAC and application dir
assemblies, but not the assemblies on the webserver.

If I use Assembly.LoadFrom then dependencies that are in the GAC won't be found and the dependencies behind startup.dll loose thier versioning/strong names since we pass it a string of the assmebly name and not a AssemblyName token.

What I need is a smart Assembly.Load that can bind and probe locally and remote.

Any ideas for a solution?

-- Ingram

// Load assembly from URL<br />
Assembly assem = Assembly.LoadFrom(@"http://remotehost/code/startup.dll");<br />
<br />
// Pre-load all dependencies<br />
LoadAllReferences(assem, new ArrayList());



// Pre-Load all depedencies
private static void LoadAllReferences(Assembly asm, ArrayList loaded)
{

    Console.WriteLine("----------- "+asm);
    foreach ( AssemblyName asr in asm.GetReferencedAssemblies() )
    {
        Console.WriteLine(asr.FullName);
    }
    Console.WriteLine("----------- **");

     foreach ( AssemblyName asr in asm.GetReferencedAssemblies() )
    {
        if (loaded.Contains(asr.FullName))
        {
            Console.WriteLine("### already loaded "+asr.ToString());
        }
        else
        {
            Console.WriteLine("**** " + asr.ToString());
            Assembly asmRef = Assembly.Load( asr );
            loaded.Add(asr.FullName);
            LoadAllReferences( asmRef, loaded );
        }
    }
}

This is a revisited question, see Google,
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&threadm=uteRFS89
BHA.1748%40tkmsftngp04&rnum=11&prev=/groups%3Fq%3Dloading%2Bassemblies%26sta
rt%3D10%26hl%3Den%26lr%3D%26ie%3DUTF-8%26safe%3Doff%26selm%3DuteRFS89BHA.174
8%2540tkmsftngp04%26rnum%3D11
[^]





Ingram Leedy

You can't depend on your eyes when your imagination is out of focus.
--Mark Twain

GeneralRe: Smart Client automatically loading ALL assemblies Pin
leppie20-Jan-03 11:29
leppie20-Jan-03 11:29 
GeneralMSDN Asynchronous Examples Pin
19-Jan-03 15:28
suss19-Jan-03 15:28 
GeneralRe: MSDN Asynchronous Examples Pin
leppie20-Jan-03 11:39
leppie20-Jan-03 11:39 
GeneralCommuncation with Macromedia Flash Pin
CNU19-Jan-03 13:37
CNU19-Jan-03 13:37 
GeneralRe: Communcation with Macromedia Flash Pin
leppie20-Jan-03 11:42
leppie20-Jan-03 11:42 
GeneralRe: Communcation with Macromedia Flash Pin
CNU20-Jan-03 18:03
CNU20-Jan-03 18:03 
GeneralCursors in .NET Assembly DLL Pin
Paul Selormey19-Jan-03 13:20
Paul Selormey19-Jan-03 13:20 
QuestionListBox without border? Pin
Wizard_0119-Jan-03 11:56
Wizard_0119-Jan-03 11:56 
AnswerRe: ListBox without border? Pin
Nnamdi Onyeyiri20-Jan-03 7:10
Nnamdi Onyeyiri20-Jan-03 7:10 
GeneralObject to byte[] Pin
Nnamdi Onyeyiri19-Jan-03 7:15
Nnamdi Onyeyiri19-Jan-03 7:15 
GeneralRe: Object to byte[] Pin
leppie19-Jan-03 7:50
leppie19-Jan-03 7:50 
GeneralRe: Object to byte[] Pin
Nnamdi Onyeyiri19-Jan-03 8:54
Nnamdi Onyeyiri19-Jan-03 8:54 
GeneralRe: Object to byte[] Pin
leppie19-Jan-03 10:17
leppie19-Jan-03 10:17 
GeneralDatagrid problem Pin
Mr BallyDaHob19-Jan-03 3:28
Mr BallyDaHob19-Jan-03 3:28 
GeneralDraw grayed image from ImageList Pin
Wizard_0119-Jan-03 1:46
Wizard_0119-Jan-03 1:46 
GeneralRe: Draw grayed image from ImageList Pin
Nnamdi Onyeyiri19-Jan-03 2:48
Nnamdi Onyeyiri19-Jan-03 2:48 
GeneralScrollBars of MDI Parent Form Pin
Nigel H. Lin19-Jan-03 1:44
Nigel H. Lin19-Jan-03 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.