Skip to content

Output Variables

Bleddyn Richards edited this page Nov 18, 2022 · 5 revisions

All version numbers used within the task are outputted as variables to be used in subsequent tasks within your build pipeline. The following output variables are created by the Assembly Info task:

AssemblyInfo.Version
AssemblyInfo.FileVersion
AssemblyInfo.InformationalVersion
AssemblyInfo.PackageVersion

Please note AssemblyInfo.PackageVersion is only available from v2 of the .Net Core & .Net Standard task.

To use these variables you will first need to define a name for the task such as:

- task: Assembly-Info-NetFramework@3
  name: 'AI'
  inputs:
    Path: '$(Build.SourcesDirectory)'
    FileNames: '**\AssemblyInfo.cs'
    InsertAttributes: true
    FileEncoding: 'utf-8'
    WriteBOM: true
    VersionNumber: '$(appVersion)'
    FileVersionNumber: '$(appVersion)'
    InformationalVersion: '$(appVersion)'
    AddBuildTag: 'v$(appVersion)'
    LogLevel: 'verbose'
    FailOnWarning: false
    DisableTelemetry: false

you can then use the output variables in subsequent tasks as follows:

- task: PublishBuildArtifacts@1
  displayName: 'Publich artifact'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'App_$(AI.AssemblyInfo.Version)'
    publishLocation: 'Container'

Output variables are covered further in Microsoft's documentation.

Clone this wiki locally