# .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://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net trigger: - master pool: vmImage: 'windows-latest' variables: solution: 'Office365APIEditor/Office365APIEditor.csproj' buildPlatform: 'AnyCPU' buildConfiguration: 'Release' steps: - task: NuGetToolInstaller@1 - task: NuGetCommand@2 inputs: restoreSolution: '$(solution)' packagesdirectory: '..\packages' - task: VSBuild@1 inputs: solution: '$(solution)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' - task: UseDotNet@2 inputs: packageType: 'sdk' version: '2.1.x' - task: EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESPR CodeSigning' FolderPath: 'Office365APIEditor\bin\Release' Pattern: 'Office365APIEditor.exe' signConfigType: 'inlineSignParams' inlineOperation: | [ { "KeyCode" : "CP-230012", "OperationCode" : "SigntoolSign", "Parameters" : { "OpusName" : "Microsoft", "OpusInfo" : "http://www.microsoft.com", "FileDigest" : "/fd \"SHA256\"", "PageHash" : "/NPH", "TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" }, "ToolName" : "sign", "ToolVersion" : "1.0" }, { "KeyCode" : "CP-230012", "OperationCode" : "SigntoolVerify", "Parameters" : {}, "ToolName" : "sign", "ToolVersion" : "1.0" } ] SessionTimeout: '60' MaxConcurrency: '50' MaxRetryAttempts: '5' - task: EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESPR CodeSigning' FolderPath: 'Office365APIEditor\StagingMSI' Pattern: 'Setup.msi' signConfigType: 'inlineSignParams' inlineOperation: | [ { "KeyCode" : "CP-230012", "OperationCode" : "SigntoolSign", "Parameters" : { "OpusName" : "Microsoft", "OpusInfo" : "http://www.microsoft.com", "FileDigest" : "/fd \"SHA256\"", "PageHash" : "/NPH", "TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" }, "ToolName" : "sign", "ToolVersion" : "1.0" }, { "KeyCode" : "CP-230012", "OperationCode" : "SigntoolVerify", "Parameters" : {}, "ToolName" : "sign", "ToolVersion" : "1.0" } ] SessionTimeout: '60' MaxConcurrency: '50' MaxRetryAttempts: '5' - task: VSTest@2 inputs: platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' - task: PowerShell@2 name: PowerShellTask env: ArtifactStagingDirectory: $(Build.ArtifactStagingDirectory) inputs: targetType: 'inline' script: | $buildNumber = [Regex]::Match((Get-Content "Office365APIEditor\Properties\AssemblyInfo.cs"), "\[assembly: AssemblyVersion\(.(\d+)\.(\d+)\.(\d+)\.(\d+)").Value.Split('"')[1]; Write-Host $buildNumber; $archivePath = $env:ArtifactStagingDirectory + "\Office365APIEditor_" + $buildNumber + ".zip"; Write-Host $archivePath; Remove-Item Office365APIEditor\bin\Release\CodeSignSummary*.md; Compress-Archive -Path Office365APIEditor\bin\Release\* -DestinationPath $archivePath -Update; Write-Host ('##vso[task.setvariable variable=archivePath;isOutput=true] ' + $archivePath); $msiPath = $env:ArtifactStagingDirectory + "\Office365APIEditor_" + $buildNumber + ".msi"; Move-Item -Path Office365APIEditor\StagingMSI\Setup.msi -Destination $msiPath - task: AzureFileCopy@4 inputs: SourcePath: '$(Build.ArtifactStagingDirectory)/*' azureSubscription: 'Azure Resource Manager service connection' Destination: 'AzureBlob' storage: 'office365apieditor' ContainerName: 'build'