In my case, the only assembly that did not load was Microsoft.VisualStudio.TeamSystem.Licensing , which is a dependency on Microsoft.VisualStudio.QualityTools.Common .
Based on Osel Miko Dลevorubec's answer , I came up with this safer strategy:
private static Type[] GetTypesFromAssemblySafe(Assembly assembly) { var ignoredAssemblies = new List<string>() { "Microsoft.VisualStudio.QualityTools.Common" //Gives trouble in TFS automated builds }; if (!ignoredAssemblies.Contains(assembly.FullName.Split(',')[0])) return assembly.GetTypes(); else return new Type[] { }; } var types = AppDomain.CurrentDomain.GetAssemblies() .ToList() .SelectMany(GetTypesFromAssemblySafe);
source share