title: dotnet build vs publish on Azure DevOps
body: <p>I have a .NET Core 2.0 console app. I can successfully build or publish this app and run it locally. I can also successfully build and publish this app in Azure DevOps. However, if I <em>build</em> the app in Azure DevOps, I cannot run the result.</p>
  
  <p>In Azure DevOps, I tried building using:</p>
  
  <p><code>dotnet build -c Release -r win-x64 -o app</code></p>
  
  <p>This generates a small number of files with just the project related files. It does not include all of the System.*.dll files, etc that seem excessive for most of my cases. This command works fine when I run it on my local machine and I can successfully click the MyApp.exe file and run my console app. However, if I run the same command on Azure DevOps, the MyApp.exe file that gets generated does not run as expected. Instead, it starts then immediately quits. Nothing is printed in the console app. I see no errors. The app is very basic, includes a "try-catch" around everything and has a <code>Console.ReadLine</code> at the end. So, I thought it would stay open. </p>
  
  <p>When I run:</p>
  
  <p><code>dotnet publish -c Release -r win-x64 -o app</code></p>
  
  <p>I get the same files, but with all of the System.*.dll files, etc. included. This time, I've noticed that I can successfully run MyApp.exe and it behaves as expected.</p>
  
  <p>Why does <code>dotnet build ...</code> work locally, but I don't seem to get the same behavior when I run <code>dotnet build ...</code> in Azure DevOps. It seems I'm forced to use <code>dotnet publish</code>. My issue is, the resulting .zip file goes from ~500kb to 30MB. This is big difference. </p>