Reputation: 699
I'm trying to make work the following code (it was decompiled):
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if ((!assembly.FullName.StartsWith("System") && !assembly.FullName.StartsWith("Microsoft")) && !assembly.FullName.StartsWith("mscorlib"))
{
list.Add(assembly.FullName);//keep the name of assembly.
}
}
foreach (string assemblyStirng in list)
{
var assembly = Assembly.Load(assemblyString);//here FileNotFoundException is thrown.
}
How is it possible? Dll is already in domain and Assembly.Load should return it.
Upvotes: 0
Views: 606
Reputation: 7141
Could it be that Assembly.Load(string)
takes an assembly name in it's long form (i.e. strongly named, maybe installed in the GAC), but you're giving it the short assembly name?
Upvotes: 1
Reputation: 942
Turn on assembly load logging with fusion log view: Fusion Log View
It will tell you detailed information about why i can't find it.
Some reasons could be, that it was loaded from somewhere else than the application dir, or it did find different versions of the same dll
Upvotes: 2