/// <summary> /// Returns the full set of <see cref="Assembly"/> instances from which to build the MEF composition container, /// </summary> /// <param name="compositionAssemblyPaths">Optional set of assembly locations to include.</param> /// <param name="logger"><see cref="ILogger"/> instance to report issues.</param> /// <returns>The set of <see cref="Assembly"/> instances to use.</returns> private static IEnumerable <Assembly> GetCompositionAssemblies(IEnumerable <string> compositionAssemblyPaths, ILogger logger) { HashSet <Assembly> assemblies = new HashSet <Assembly>(); if (compositionAssemblyPaths != null) { foreach (string assemblyPath in compositionAssemblyPaths) { Assembly a = AssemblyUtilities.LoadAssembly(assemblyPath, logger); if (a != null) { // Don't put System assemblies into container if (!a.IsSystemAssembly()) { assemblies.Add(a); } } } } // Add this assembly itself to allow MEF to satisfy our imports assemblies.Add(typeof(ClientCodeGenerationDispatcher).Assembly); return(assemblies); }
/// <summary> /// Invoked once to force load all assemblies into an analysis unit /// </summary> private void LoadAllAssembliesAndSetAssemblyResolver() { _loadedAssemblies = new Dictionary <Assembly, bool>(); foreach (var assemblyName in _assembliesToLoad) { Assembly assembly = AssemblyUtilities.LoadAssembly(assemblyName, _logger); if (assembly != null) { // The bool value indicates whether this assembly should be searched for a Entity _loadedAssemblies[assembly] = !assembly.IsSystemAssembly(); } } AssemblyUtilities.SetAssemblyResolver(_loadedAssemblies.Keys); }