title: Prevent website build failure due to iis locking dll
body: <p>I have a MVC/C# based website. One of the nuget packages being used is a wrapper around PDFium, a non .NET dll. The PDFium dll is included as part of another nuget package and is just a dll that gets copied into the output directory.</p>
  
  <p>The problem I have is that after I have used the website the PDFium dll (ie the non .net one, not the one that is doing the wrapping) seems to get loaded and then locked by IIS. If I then try to do a build in Visual Studio I get an error saying:</p>
  
  <blockquote>
    <p>Unable to copy file [Full Source Path]. The process cannot access the file [destination path] because it is being used by another process.    </p>
  </blockquote>
  
  <p>A second line in the build error log shows something similar and additionally confirms:</p>
  
  <blockquote>
    <p>The file is locked by: "IIS Worker Process (28776)"</p>
  </blockquote>
  
  <p>If I do an <code>iisreset</code> then this will cause that worker process to get killed and thus the copy can happen but I am wondering if there is any kind of better way of doing this. My thought is that all the other DLLs included by nuget packages and similar get copied just fine so maybe there is something a bit more "proper" that can be done to resolve this rather than the slightly heavy handed iisreset approach...</p>