EF Downgraded: Could not load file or assembly 'EntityFramework' or one of its dependencies
<p>I have been getting the error below and for heavens sake I cannot figure out why. I have not made any changes except for upgrading to windows 10. I have downgraded my EF and upgraded to make sure I have the same version but that did not resolve. I have tried all options, did self host the application but even that did not help eliminating Visual Studio issues. </p>

<p>Would appreciate any suggestions please.</p>

<p>Could not load file or assembly <code>'EntityFramework'</code> or one of its dependencies. 
The process cannot access the file because it is being used by another process</p>

<blockquote>
  <p>Description: An unhandled exception occurred during the execution of
  the current web request. Please review the stack trace for more
  information about the error and where it originated in the code.</p>
  
  <p>Exception Details: System.IO.FileLoadException: Could not load file
  or assembly 'EntityFramework' or one of its dependencies. The process
  cannot access the file because it is being used by another process.
  (Exception from HRESULT: 0x80070020)</p>
</blockquote>

<p><strong>Source Error:</strong> </p>

<blockquote>
  <p>An unhandled exception was generated during the execution of the
  current web request. Information regarding the origin and location of
  the exception can be identified using the exception stack trace below.</p>
  
  <p>Assembly Load Trace: The following information can be helpful to
  determine why the assembly 'EntityFramework' could not be loaded.</p>
</blockquote>

<p><strong>=== Pre-bind state information ===</strong></p>

<pre><code>&gt; LOG: DisplayName = EntityFramework  (Partial) WRN: Partial binding
&gt; information was supplied for an assembly: WRN: Assembly Name:
&gt; EntityFramework | Domain ID: 2 WRN: A partial bind occurs when only
&gt; part of the assembly display name is provided. WRN: This might result
&gt; in the binder loading an incorrect assembly. WRN: It is recommended to
&gt; provide a fully specified textual identity for the assembly, WRN: that
&gt; consists of the simple name, version, culture, and public key token.
&gt; WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for
&gt; more information and common solutions to this issue. LOG: Appbase =
&gt; file:///C:/src/prjPptsWa/ LOG: Initial PrivatePath =
&gt; C:\src\prjPptsWa\bin Calling assembly : (Unknown).
&gt; === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\src\prjPptsWa\web.config LOG: Using
&gt; host configuration file:
&gt; C:\Users\Documents\IISExpress\config\aspnet.config LOG: Using machine
&gt; configuration file from
&gt; C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
&gt; LOG: Policy not being applied to reference at this time (private,
&gt; custom, partial, or location-based assembly bind). LOG: Attempting
&gt; download of new URL
&gt; file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
&gt; ASP.NET Files/root/17d130d2/d3bf1590/EntityFramework.DLL. LOG:
&gt; Attempting download of new URL
&gt; file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
&gt; ASP.NET
&gt; Files/root/17d130d2/d3bf1590/EntityFramework/EntityFramework.DLL. LOG:
&gt; Attempting download of new URL
&gt; file:///C:/src/prjPptsWa/bin/EntityFramework.DLL. LOG: Using
&gt; application configuration file: C:\src\prjPptsWa\web.config LOG: Using
&gt; host configuration file:
&gt; C:\Users\Documents\IISExpress\config\aspnet.config LOG: Using machine
&gt; configuration file from
&gt; C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
&gt; LOG: Post-policy reference: EntityFramework, Version=6.0.0.0,
&gt; Culture=neutral, PublicKeyToken=b77a5c561934e089 ERR: Failed to
&gt; complete setup of assembly (hr = 0x80070020). Probing terminated.
</code></pre>

<p><strong>Stack Trace:</strong> </p>

<pre><code>[FileLoadException: Could not load file or assembly 'EntityFramework' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]

[FileLoadException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +21
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean&amp; isRefAssemblyLoaded) +290
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946132
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
</code></pre>

<p><strong>Update:-</strong> Got a fix for my issue, the fix was to remove the mapping and remap to another folder. For some reason the old folder was holding dll's from being loaded. </p>