Azure Pipeline YAML for API that requires MSI

 variables:

- name: buildConfiguration

  value: 'Release'

- name: buildPlatform

  value: 'Any CPU'

- name: major

  value: 2

- name: minor

  value: 0

- name: patch

  value: $[counter(format('{0}.{1}',variables['Major'],variables['Minor']), 0)]

- name: sonarQubeKeyRoot

  value: $[format('{0}_StorePricing',replace(variables['System.TeamProject'], ' ', '_'))]


name: $(Major).$(Minor).$(Patch)


trigger:

  branches:

    include:

    - main


pool:

  name: Azure Pipelines

  vmImage: 'windows-2022'

  demands:

  - msbuild

  - visualstudio


jobs:

- job: analyzeAndTest

  displayName: 'Analyze and Test'

  

  steps:

        

  - task: DotNetCoreCLI@2

    displayName: 'API dotnet restore'

    inputs:

      command: 'restore'

      projects: |

        **/XXXXX.sln

      feedsToUse: 'select'

      vstsFeed: '6d134f88-0899-44a2-a361-9f2e52000d74'


  - task: SonarQubePrepare@4

    inputs:

      SonarQube: 'SonarQube Prod-Customer Experience'

      scannerMode: 'MSBuild'

      projectKey: '$(SonarQubeKeyRoot)_API'

      projectName: 'XXXXX'

      projectVersion: '$(Major).$(Minor)'


  - task: DotNetCoreCLI@2

    displayName: 'API dotnet Build'

    inputs:

      command: 'build'

      projects: |

        **/XXXXX.csproj

        **/XXXXX.csproj

      arguments: '-c $(buildConfiguration) -f net8.0 --nologo'


  - task: DotNetCoreCLI@2

    displayName: 'API dotnet test'

    inputs:

      command: test

      projects: |

        **/XXXXX.Tests.csproj

      arguments: '-c $(buildConfiguration) -f net8.0 --no-build --collect "Code coverage" --nologo'


  - task: Assembly-Info-NetCore@2

    displayName: 'Set Assembly Manifest Data'

    inputs:

      FileNames: |

        **/XXXXX.csproj

        **/XXXXX.csproj

      InsertAttributes: true

      Authors: 'Customer Engagement'

      Company: 'XXXXX Corporation'

      Product: 'XXXXX'

      Description: 'API for XXXXX.'

      Copyright: 'Copyright XXXXX Corporation. All rights reserved.'

      VersionNumber: '$(Major).$(Minor).$(Patch)'

      FileVersionNumber: '$(Major).$(Minor).$(Patch)'

      InformationalVersion: '$(Major).$(Minor).$(Patch)'

      PackageVersion: '$(Major).$(Minor).$(Patch)'

      

  - task: DotNetCoreCLI@2

    displayName: WIX MSI NetCore build

    inputs:

      projects: |

        **/XXXXX.Setup.wixproj

      arguments: /p:OutputPath="$(Build.StagingDirectory)" /p:RunWixToolsOutOfProc=true


  - task: SonarQubeAnalyze@4

  - task: SonarQubePublish@4


  - task: PublishPipelineArtifact@1

    displayName: Publish MSI

    inputs:

      path: $(Build.ArtifactStagingDirectory)\XXXXX.Setup.msi

      artifactName: QT.SP



Comments

Popular posts from this blog

Upgrading to .NET8 from desktop versions 4.8.X

GHL Chat Bots for Webpage

GHL > Set website so shorter URL address