private XafApplication GetApplication(string executableName, TypesInfo typesInfo) {
     string assemblyPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
     try {
         ReflectionHelper.AddResolvePath(assemblyPath);
         var assembly = ReflectionHelper.GetAssembly(Path.GetFileNameWithoutExtension(executableName), assemblyPath);
         var assemblyInfo = typesInfo.FindAssemblyInfo(assembly);
         ((ITypesInfo)typesInfo).LoadTypes(assembly);
         var findTypeInfo = typesInfo.FindTypeInfo(typeof(XafApplication));
         var findTypeDescendants = ReflectionHelper.FindTypeDescendants(assemblyInfo, findTypeInfo, false);
         return Enumerator.GetFirst(findTypeDescendants).CreateInstance(new object[0]) as XafApplication;
     } finally {
         ReflectionHelper.RemoveResolvePath(assemblyPath);
     }
 }