title: Publishing a dotnet application that's already running
body: <p>I'm attempting to create a script to simplify the process of publishing a .NET Core website. I'm running into an issue when I run <code>dotnet publish</code> against an already running server. The server is IIS with the dotnet bundle installed, so IIS uses its app pool to start dotnet.</p>
  
  <p>Here's my batch file. I'm happy to use another script type:</p>
  
  <pre><code>cd src/app
  dotnet build --no-incremental
  dotnet publish --framework netcoreapp1.0 --configuration Release --output ../../dist
  </code></pre>
  
  <p>When I run the script I get this error:</p>
  
  <blockquote>
    <p>"The process cannot access the file 'C:\inetpub\wwwroot\app\dist\app.dll' because it is being used by another process."</p>
  </blockquote>
  
  <p>This makes sense, it appears I need to stop, deploy, and restart dotnet. Can I do this from the script? Or is my approach to this problem wrong?</p>