in src/lib/Microsoft.Fx.Portability.Cci/HostEnvironment.cs [396:450]
public override AssemblyIdentity ProbeAssemblyReference(IUnit referringUnit, AssemblyIdentity referencedAssembly)
{
// We need to ensure the core assembly is being unified and in some code paths, such as from GetCoreAssemblySymbolicIdentity
// it doesn't get properly unified before calling ProbeAssemblyReference
if (CoreAssemblySymbolicIdentity.Equals(referencedAssembly))
{
referencedAssembly = UnifyAssembly(referencedAssembly);
}
AssemblyIdentity result = null;
if (this.ResolveInReferringUnitLocation)
{
// NOTE: When probing for the core assembly, the referring unit is a dummy unit and thus does not have
// a location.
var referringDir = string.IsNullOrEmpty(referringUnit.Location) ? null
: Path.GetDirectoryName(Path.GetFullPath(referringUnit.Location));
result = string.IsNullOrEmpty(referringDir) ? null
: Probe(referringDir, referencedAssembly);
if (result != null)
{
return result;
}
}
// Probe in the libPaths directories
foreach (string libPath in this.LibPaths)
{
result = this.Probe(libPath, referencedAssembly);
if (result != null)
{
return result;
}
}
if (this.ResolveAgainstRunningFramework)
{
// Call base probe which has logic to check the frameworks installed on the machine
result = base.ProbeAssemblyReference(referringUnit, referencedAssembly);
if (result != null && result.Location != null && !result.Location.StartsWith("unknown", StringComparison.Ordinal))
{
return result;
}
}
var unresolved = new UnresolvedReference<IUnit, AssemblyIdentity>(referringUnit, referencedAssembly);
OnUnableToResolve(unresolved);
// Give up
return new AssemblyIdentity(referencedAssembly, "unknown://location");
}