Click here to Skip to main content
15,922,630 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem about pictureBox in Visual Studio C Sharp.NET ? Pin
zeeShan anSari27-Jun-07 0:04
zeeShan anSari27-Jun-07 0:04 
QuestionXML with C# [modified] Pin
saymajum25-Jun-07 8:13
saymajum25-Jun-07 8:13 
GeneralRe: XML with C# Pin
Rob Graham25-Jun-07 8:38
Rob Graham25-Jun-07 8:38 
GeneralRe: XML with C# Pin
saymajum25-Jun-07 8:44
saymajum25-Jun-07 8:44 
GeneralRe: XML with C# Pin
Christian Graus25-Jun-07 10:26
protectorChristian Graus25-Jun-07 10:26 
GeneralRe: XML with C# Pin
saymajum25-Jun-07 10:34
saymajum25-Jun-07 10:34 
AnswerRe: XML with C# Pin
BoneSoft25-Jun-07 11:21
BoneSoft25-Jun-07 11:21 
QuestionLoading referenced assemblies using System.Reflection Pin
thegloomyclown25-Jun-07 6:44
thegloomyclown25-Jun-07 6:44 
Hi,

I'm trying to get the Assembly objects which are used by a particular executable, but I'm getting a FileNotFoundException when I try to load referenced assemblies.
public static void ProcessAssembly(string filename)
{
    Assembly assembly = Assembly.LoadFrom(filename);
    AssemblyName[] names = assembly.GetReferencedAssemblies();
    foreach (AssemblyName name in names)
    {
        Assembly referenced = Assembly.Load(name); //FileNotFoundException here
        ProcessReferencedAssembly(referenced);
    }
}

The reason the Exception occurs is obviously because the referenced assembly is in the same folder as the assembly we're looking at, and not the executing assembly.

My question is, in general, how can I get the Assembly for these? The only (unreliable) way of doing this I can think of is to use the AssemblyName to guess the filename of the Assembly (e.g. add ".dll").

Thanks in advance!
AnswerRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 6:47
Ed.Poore25-Jun-07 6:47 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown25-Jun-07 6:59
thegloomyclown25-Jun-07 6:59 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 8:32
Ed.Poore25-Jun-07 8:32 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown25-Jun-07 8:45
thegloomyclown25-Jun-07 8:45 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 8:57
Ed.Poore25-Jun-07 8:57 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown25-Jun-07 9:04
thegloomyclown25-Jun-07 9:04 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 9:38
Ed.Poore25-Jun-07 9:38 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 9:38
Ed.Poore25-Jun-07 9:38 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown25-Jun-07 10:47
thegloomyclown25-Jun-07 10:47 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 11:11
Ed.Poore25-Jun-07 11:11 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown25-Jun-07 11:27
thegloomyclown25-Jun-07 11:27 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 11:59
Ed.Poore25-Jun-07 11:59 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore25-Jun-07 12:19
Ed.Poore25-Jun-07 12:19 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown26-Jun-07 4:45
thegloomyclown26-Jun-07 4:45 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore26-Jun-07 5:02
Ed.Poore26-Jun-07 5:02 
QuestionMultiThreading Pin
HexaDeveloper25-Jun-07 5:53
HexaDeveloper25-Jun-07 5:53 
AnswerRe: MultiThreading Pin
led mike25-Jun-07 6:11
led mike25-Jun-07 6:11 

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.