Assembly Link Not Found - How to get all the DLLs included in the solution

I am running a WCF application CoreApplicationwhose VS project has a link to AncillaryProject. CoreApplicationuses a class Providerfrom AncillaryProject; however, it is never explicitly mentioned - it is called through Reflection.

My problem is that sometimes CoreApplicationit can’t be found Providerbecause it AncillaryProjectdoes not appear in the call GetAssemblies(). Sometimes this works fine, but sometimes (I assume it might be after the JIT), it fails.

Here is my original code:

var providers = from d in AppDomain.CurrentDomain.GetAssemblies()
                from c in d.GetTypes()
                where typeof(BaseProvider).IsAssignableFrom(c)
                select c;

After looking at this question , I tried using GetReferencedAssemblies():

var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
{
    allAssemblies = allAssemblies.Union(
                          a.GetReferencedAssemblies()
                           .Select(b => System.Reflection.Assembly.Load(b)));
}
var providers = from d in allAssemblies
                from c in d.GetTypes()
                where typeof(BaseProvider).IsAssignableFrom(c)
                select c;

, , , DLL bin, . , .NET ? , -, ?

+5
3

Microsoft AppDomain.CurrentDomain.GetAssemblies() , . AppDomain.CurrentDomain.GetAssemblies()

, appdomain DLL .

+9

AssemblyResolve AncillaryProject.dll

http://msdn.microsoft.com/en-us/library/ff527268.aspx

+3

You must download the .NET development SDK and run FuslogVw.exe (view the merge log). It will report the CLR application, trying to resolve .NET dependencies. He will show you if this was so, and how he evaluates the candidates who are in these places.

+3
source

All Articles