Skip to content

Instantly share code, notes, and snippets.

@loaded02
Created December 14, 2021 13:45
Show Gist options
  • Save loaded02/b4b235a3f4f4e3af0e233a15c50bb9ff to your computer and use it in GitHub Desktop.
Save loaded02/b4b235a3f4f4e3af0e233a15c50bb9ff to your computer and use it in GitHub Desktop.
Azure Build Pipeline for XSharp
trigger:
- main
pool:
vmImage: 'windows-2019'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
XSharpMsBuildDir: '$(Build.SourcesDirectory)/XSharp/MsBuild'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: PowerShell@2
displayName: set variables
inputs:
targetType: 'inline'
script: |
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};$(Build.SourcesDirectory)\XSharp\Bin"
$RegistryPath = 'HKLM:\Software\WOW6432Node\XSharpBV\XSharp'
$Name = 'XSharpPath'
$Value = '$(Build.SourcesDirectory)\XSharp'
If (-NOT (Test-Path $RegistryPath)) {
New-Item -Path $RegistryPath -Force | Out-Null
}
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType String -Force
- task: PowerShell@2
displayName: log variables
inputs:
targetType: 'inline'
script: |
Write-Host "##[debug]$env:PATH"
$reg_key = Get-ItemProperty -Path "HKLM:\Software\WOW6432Node\XSharpBV\XSharp"
Write-Host "##[debug]$reg_key"
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:IncludePath="$(SolutionDir)\XSharp\Include" /p:ReferencePath="..\XSharp\Assemblies"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '$(BuildConfiguration)/?(*.exe|*.dll|*.pdb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment