title: AzureDevOps - Can't publish as single file
body: <p><strong>Edit: see end of the post for working yaml.</strong></p>
  
  <p>I'm trying to publish a .NET Core 3.1 Console App as single file however I can't seem to succeed through Azure Devops Pipelines:</p>
  
  <p>Self-contained or not, the publish result is always a bunch of dll instead of just being my executable.</p>
  
  <p>Publishing as single fine works just fine on my computer (publishing from VS or the .NET Core CLI with the params I've set in the yaml below)</p>
  
  <p>Here's the yaml responsible for the build:</p>
  
  <pre class="lang-yaml prettyprint-override"><code># Starter pipeline
  # Start with a minimal pipeline that you can customize to build and deploy your code.
  # Add steps that build, run tests, deploy, and more:
  # https://aka.ms/yaml
  
  trigger:
  - feature/linux
  
  pool:
    vmImage: 'ubuntu-latest'
  
  steps:
  - task: UseDotNet@2
    displayName: 'Use .Net Core sdk 3.1.x'
    inputs:
      version: 3.1.x
  
  - task: DotNetCoreCLI@2
    displayName: 'dotnet restore'
    inputs:
      command: restore
      projects: './Project/Project.csproj'
      feedsToUse: config
      nugetConfigPath: ./NuGet/NuGet.Config
  
  - task: DotNetCoreCLI@2
    displayName: 'dotnet publish'
    inputs:
      projects: './Project/Project.csproj'
      arguments: '-o $(build.artifactstagingdirectory) -r linux-x64 -c Release -f netcoreapp3.1 -p:PublishSingleFile=true -p:SelfContained=false'
  
  - task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: drop'
  </code></pre>
  
  
  
  <hr>
  
  <p><strong>Solution:</strong></p>
  
  <p>I'm dumb, simply forgot the command part under dotnet publish.. the resulting command by default is build.
  Note that you need to also specify</p>
  
  <pre><code>publishWebProjects: false
  </code></pre>
  
  <p>For a console project, see full working yaml:</p>
  
  <pre class="lang-yaml prettyprint-override"><code># Starter pipeline
  # Start with a minimal pipeline that you can customize to build and deploy your code.
  # Add steps that build, run tests, deploy, and more:
  # https://aka.ms/yaml
  
  trigger:
  - feature/linux
  
  pool:
    vmImage: 'ubuntu-latest'
  
  steps:
  - task: DotNetCoreCLI@2
    displayName: 'dotnet restore'
    inputs:
      command: restore
      projects: '**/Project.csproj'
      feedsToUse: config
      nugetConfigPath: ./NuGet/NuGet.Config
  
  - task: DotNetCoreCLI@2
    displayName: 'dotnet publish'
    inputs:
      command: 'publish'
      publishWebProjects: false
      projects: '**/Project.csproj'
      modifyOutputPath: true
      arguments: '-o $(build.artifactstagingdirectory) -r linux-x64 -c Release -f netcoreapp3.1 -p:PublishSingleFile=true -p:SelfContained=false'
  
  - task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: drop'
    inputs:
      artifactName: 'drop' 
      PathtoPublish: '$(build.artifactstagingdirectory)'
  </code></pre>
  
  
  
  <p>Any help is welcome :)</p>