skip to Main Content

I’m trying to create an artifact from the project I built on Azure Pipelines in a release build, but when I look at the results of the build it’s in Debug mode and I’m not sure what I’m doing incorrect.

I’m passing the build configuration through a variable, but I checked it via the names of the steps and it looks correct and I’ve read through the documentation to double check what I’m doing wrong but nothing seems off to me

# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- azure-pipelines-self-hosted

pool:
  vmImage: 'ubuntu-latest'

variables:
  solution: 'Something.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:

- task: UseDotNet@2
  inputs:
    version: '5.0.x'
    packageType: 'sdk'

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: $(solution)
    feedsToUse: select

- task: DotNetCoreCLI@2
  displayName: 'dotnet build $(buildConfiguration)'
  inputs:
    command: build
    includeNuGetOrg: true
    projects: $(solution)
    configuration: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'dotnet test $(buildConfiguration)'
  inputs:
    command: 'test'
    projects: $(solution)
    configuration: '--configuration $(buildConfiguration)'


- task: CopyFiles@2
  inputs:
    sourceFolder: '$(Build.SourcesDirectory)'
    Contents: |
      **/*
      !.git/**/*
    targetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  inputs:
    pathToPublish: '$(Build.ArtifactStagingDirectory)'
    artifactName: drop

2

Answers


  1. More info is needed but start by Double clicking your project or all projects if you have multiple in the Something.sln and check the .csproj file config, is the app in debug mode.

    Login or Signup to reply.
  2. In the inputs section, change configuration item name to arguments

    e.g.

    - task: DotNetCoreCLI@2
      displayName: 'dotnet build $(buildConfiguration)'
      inputs:
        command: build
        includeNuGetOrg: true
        projects: $(solution)
        arguments: '--configuration $(buildConfiguration)'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search