title: Application process will not close
body: <p>I have a WPF application, after closing the app its process <code>app.exe *32</code> is still running in the processes list in task manager.</p>
  
  <p>I need this to close as when I make an edit to my code I get the following error -</p>
  
  <pre><code>Unable to copy file "obj\x86\Release\frontEndTest.exe" to "bin\Release\app.exe". The process cannot access the file 'bin\Release\app.exe' because it is being used by another process.
  </code></pre>
  
  <p>I am aware that this sort of question has been asked before <a href="https://stackoverflow.com/questions/2895898/visual-studio-build-fails-unable-to-copy-exe-file-from-obj-debug-to-bin-debug">here.</a></p>
  
  <p>However the solution did not work for me by changing my <code>Assembly.cs</code> to -</p>
  
  <pre><code>[assembly: AssemblyVersion("2.0.0")]
  [assembly: AssemblyFileVersion("2.0.0")]
  </code></pre>
  
  <p>I thought that perhaps if I were to find the <code>Window closed</code> event and puttting something like - <code>Process.GetCurrentProcess().Kill();</code> in the event so that when a user closed the application from the red <code>'x'</code> button in the top right of the form this would perhaps kill the process? </p>