/// <summary> /// Attaches the assembly resolution method to the <see cref="AppDomain.AssemblyResolve"/> /// event of the current <see cref="AppDomain"/>. /// </summary> /// <exception cref="InvalidOperationException"> /// Thrown when <see cref="FileBasedResolver.StoreFilePaths"/> has not been called prior to /// attaching the directory resolver to an <see cref="AppDomain"/>. /// </exception> public void Attach() { { Lokad.Enforce.NotNull(() => m_Files); } var domain = AppDomain.CurrentDomain; { var helper = new FusionHelper(() => m_Files); domain.AssemblyResolve += helper.LocateAssemblyOnAssemblyLoadFailure; } }
/// <summary> /// Attaches the assembly resolution method to the <see cref="AppDomain.AssemblyResolve"/> /// event of the current <see cref="AppDomain"/>. /// </summary> /// <exception cref="InvalidOperationException"> /// Thrown when <see cref="DirectoryBasedResolver.StoreDirectoryPaths"/> has not been called prior to /// attaching the directory resolver to an <see cref="AppDomain"/>. /// </exception> public void Attach() { { Lokad.Enforce.NotNull(() => m_Directories); } var domain = AppDomain.CurrentDomain; { var helper = new FusionHelper( () => m_Directories.SelectMany( dir => Directory.GetFiles( dir, "*.dll", SearchOption.AllDirectories))); domain.AssemblyResolve += helper.LocateAssemblyOnAssemblyLoadFailure; } }