title: How to resolve "Could not load file or assembly 'Microsoft.Practices.Prism' " error?
body: <p>I've been searching the past few days trying to get an error fixed in a WPF application using Prism, but haven't had any luck and thought I'd see if Stackoverflow had any ideas. Please note, I'm definitely a noob when it comes to Prism in general :)</p>
  
  <p>I'm in the process of learning how to create an application using Prism, with Unity being my dependency injection container of choice. I'm trying to load modules using a modified App.config file, but I'm getting a runtime error related to the bootstrapper. The error messages will be more accurate than any explanation I can provide, so I've included the App.config file, App.xaml.cs file where the error is appearing, and the error information below.</p>
  
  <p>Thank you in advance for any insight you can provide, and let me know if there's any additional information you might need!</p>
  
  <p><strong>EDIT</strong>: This file directory referenced in the error (C:\Users\Roger\Documents\TestPrismProject\WpfApplication1\WpfApplication1\bin\Debug\WpfApplication1.exe.Config line 4) refers to the fourth line of App.config file (section name= ...). All the tutorials and references I've found are the same as what I have, but this is still the line that's causing issues it seems.</p>
  
  <p><strong>EDIT 2</strong>: The line referenced in the first edit is actually exactly the same as what's on the official <a href="https://msdn.microsoft.com/en-us/library/gg405479(v=pandp.40).aspx" rel="nofollow">Microsoft Prism guide</a>.</p>
  
  <p><strong>EDIT 3</strong>: So I never did figure out the root of what was causing this, but in my frustration I restarted the example project I was working through and am not getting the error in the new project. Still not sure what the root of the problem was though.</p>
  
  <p><strong>EDIT 4</strong>: Just kidding, the same error is back in the new program.</p>
  
  <hr>
  
  <p>App.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="modules" type="Microsoft.Practices.Prism.Modularity.ModulesConfigurationSection, Microsoft.Practices.Prism"/&gt;
    &lt;/configSections&gt;
  
    &lt;modules&gt;
      &lt;module assemblyFile="EmailModule.dll" moduleType="EmailService.ModuleDefinitions.Module, EmailService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="EmailModule" startupLoaded="true" /&gt;
    &lt;/modules&gt;
  
  
    &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
    &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <hr>
  
  <p>App.xaml.cs (error appears on the "bootstrapper.Run()" line):</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.Data;
  using System.Linq;
  using System.Threading.Tasks;
  using System.Windows;
  
  namespace EmailClient
  {
      /// &lt;summary&gt;
      /// Interaction logic for App.xaml
      /// &lt;/summary&gt;
      public partial class App : Application
      {
          protected override void OnStartup(StartupEventArgs e)
          {
              base.OnStartup(e);
  
              MyBootstrapper bootstrapper = new MyBootstrapper();
              bootstrapper.Run();
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Error Message:</p>
  
  <blockquote>
    <p>System.Configuration.ConfigurationErrorsException was unhandled
      HResult=-2146232062
      Message=An error occurred creating the configuration section handler for modules: Could not load file or assembly 'Microsoft.Practices.Prism' or one of its dependencies. The system cannot find the file specified. (C:\Users\Roger\Documents\TestPrismProject\WpfApplication1\WpfApplication1\bin\Debug\WpfApplication1.exe.Config line 4)
      Source=System.Configuration
      BareMessage=An error occurred creating the configuration section handler for modules: Could not load file or assembly 'Microsoft.Practices.Prism' or one of its dependencies. The system cannot find the file specified.
      Filename=C:\Users\Roger\Documents\TestPrismProject\WpfApplication1\WpfApplication1\bin\Debug\WpfApplication1.exe.Config
      Line=4
      StackTrace:
           at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp; isRootDeclaredHere)
           at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp; result, Object&amp; resultRuntimeObject)
           at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
           at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
           at System.Configuration.ConfigurationManager.GetSection(String sectionName)
           at Microsoft.Practices.Prism.Modularity.ConfigurationStore.RetrieveModuleConfigurationSection()
           at Microsoft.Practices.Prism.Modularity.ConfigurationModuleCatalog.EnsureModulesDiscovered()
           at Microsoft.Practices.Prism.Modularity.ConfigurationModuleCatalog.InnerLoad()
           at Microsoft.Practices.Prism.Modularity.ModuleCatalog.Load()
           at Microsoft.Practices.Prism.Modularity.ModuleCatalog.Initialize()
           at Microsoft.Practices.Prism.Modularity.ModuleManager.Run()
           at Microsoft.Practices.Prism.UnityExtensions.UnityBootstrapper.InitializeModules()
           at Microsoft.Practices.Prism.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
           at Microsoft.Practices.Prism.Bootstrapper.Run()
           at EmailClient.App.OnStartup(StartupEventArgs e) in c:\Users\Roger\Documents\TestPrismProject\WpfApplication1\WpfApplication1\App.xaml.cs:line 21
           at System.Windows.Application.&lt;.ctor>b__1(Object unused)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
           at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Threading.DispatcherOperation.Invoke()
           at System.Windows.Threading.Dispatcher.ProcessQueue()
           at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
           at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
           at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
           at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
           at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg)
           at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.Run()
           at System.Windows.Application.RunDispatcher(Object ignore)
           at System.Windows.Application.RunInternal(Window window)
           at System.Windows.Application.Run(Window window)
           at System.Windows.Application.Run()
           at EmailClient.App.Main() in c:\Users\Roger\Documents\TestPrismProject\WpfApplication1\WpfApplication1\obj\Debug\App.g.cs:line 50
      InnerException: System.IO.FileNotFoundException
           HResult=-2147024894
           Message=Could not load file or assembly 'Microsoft.Practices.Prism' or one of its dependencies. The system cannot find the file specified.
           Source=System.Configuration
           FileName=Microsoft.Practices.Prism
           FusionLog==== Pre-bind state information ===
    LOG: DisplayName = Microsoft.Practices.Prism
     (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: Microsoft.Practices.Prism | Domain ID: 1
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    WRN: See whitepaper <a href="http://go.microsoft.com/fwlink/?LinkId=109270" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=109270</a> for more information and common solutions to this issue.
    LOG: Appbase = file:///C:/Users/Roger/Documents/TestPrismProject/WpfApplication1/WpfApplication1/bin/Debug/
    LOG: Initial PrivatePath = NULL
    Calling assembly : System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\Roger\Documents\TestPrismProject\WpfApplication1\WpfApplication1\bin\Debug\WpfApplication1.exe.Config
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/Users/Roger/Documents/TestPrismProject/WpfApplication1/WpfApplication1/bin/Debug/Microsoft.Practices.Prism.DLL.
    LOG: Attempting download of new URL file:///C:/Users/Roger/Documents/TestPrismProject/WpfApplication1/WpfApplication1/bin/Debug/Microsoft.Practices.Prism/Microsoft.Practices.Prism.DLL.
    LOG: Attempting download of new URL file:///C:/Users/Roger/Documents/TestPrismProject/WpfApplication1/WpfApplication1/bin/Debug/Microsoft.Practices.Prism.EXE.
    LOG: Attempting download of new URL file:///C:/Users/Roger/Documents/TestPrismProject/WpfApplication1/WpfApplication1/bin/Debug/Microsoft.Practices.Prism/Microsoft.Practices.Prism.EXE.</p>
  </blockquote>
  
  <pre><code>   StackTrace:
          at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
          at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
          at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
          at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
          at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp; isRootDeclaredHere)
     InnerException: 
  </code></pre>