Another answer shows a better way to get (at runtime) a Type defined in Assembly that cannot be loaded:
var T1 = Type.GetType("System.Web.Configuration.IAssemblyCache, " + "System.Web, " + "Version=4.0.0.0, " + "Culture=neutral, " + "PublicKeyToken=b03f5f7f11d50a3a");
As you can see, unfortunately, this method requires that you provide the full AssemblyQualifiedName Type and will not work with any of the shortened forms of the assembly name I tried. This somewhat strikes our main goals. If you knew what the assembly details, it would be much harder to just download it yourself:
var T2 = Assembly.Load("System.Web, " + "Version=4.0.0.0, " + "Culture=neutral, " + "PublicKeyToken=b03f5f7f11d50a3a") .GetType("System.Web.Configuration.IAssemblyCache");
Although these two examples look the same, they execute very different code codes; note, for example, that the latest version causes an instance to overload on Assembly.GetType compared to a static call to Type.GetType . Because of this, the second version is probably faster or more efficient. In any case, it seems that you get into the next internal CLR method and with the second argument set to false , and therefore none of the methods try to find the required assembly on your behalf.
[System.Runtime.Remoting.RemotingServices]
private static RuntimeType LoadClrTypeWithPartialBindFallback (
String typeName,
bool partialFallback);
A small step forward from these inconveniences will be to instead invoke this CLR method yourself, but with the partialFallback parameter set to true . In this mode, the function will take a shortened version of AssemblyQualifiedName and find and load the appropriate assembly, if necessary:
static Func<String, bool, TypeInfo> LoadClrTypeWithPartialBindFallback = typeof(RemotingServices) .GetMethod("LoadClrTypeWithPartialBindFallback", (BindingFlags)0x28) .CreateDelegate(typeof(Func<String, bool, TypeInfo>)) as Func<String, bool, TypeInfo>;
This works as shown, and also continues to support the full description of AssemblyQualifiedName , as in the previous examples. This is a small improvement, but it is still not a completely unqualified namespace search, since you still need to specify the assembly short name, even if it can be inferred from the namespace that appears in the type name itself.