|
| 1 | +# template-build.yaml |
| 2 | +# Restore and build the solution so that the test assemblies exist before |
| 3 | +# the VSTest steps run. This is required on Microsoft-hosted (ephemeral) |
| 4 | +# agents, which start from a clean workspace with no pre-built output. |
| 5 | + |
| 6 | +steps: |
| 7 | +# On ADO agents (TF_BUILD=true) the OWIN project pins Microsoft.IdentityModel |
| 8 | +# WsFederation/Saml to 5.7.1, which is only published to the internal IDDP |
| 9 | +# Azure Artifacts feed (not nuget.org). Route restore exclusively through IDDP, |
| 10 | +# which upstreams nuget.org for all other packages. Credentials are provided by |
| 11 | +# the NuGetAuthenticate@1 task that runs earlier in |
| 12 | +# template-install-dependencies.yaml. This mirrors |
| 13 | +# build/template-restore-build-MSIdentityWeb.yaml. |
| 14 | +- powershell: | |
| 15 | + $configFile = "$(Build.SourcesDirectory)/NuGet.Config" |
| 16 | + $iddpUrl = "https://identitydivision.pkgs.visualstudio.com/_packaging/IDDP/nuget/v3/index.json" |
| 17 | +
|
| 18 | + Write-Host "Existing NuGet sources:" |
| 19 | + dotnet nuget list source |
| 20 | +
|
| 21 | + # Remove the public nuget.org source so restore uses IDDP (with upstream) only. |
| 22 | + $existingSources = dotnet nuget list source --format Short |
| 23 | + if ($existingSources -match [regex]::Escape("https://api.nuget.org/v3/index.json")) { |
| 24 | + Write-Host "Removing public nuget.org source..." |
| 25 | + dotnet nuget remove source NuGet --configfile $configFile |
| 26 | + if (-not $?) { Write-Error "Failed to remove nuget.org source."; exit 1 } |
| 27 | + } |
| 28 | +
|
| 29 | + # Add the internal IDDP source if not already present. |
| 30 | + $existingSources = dotnet nuget list source --format Short |
| 31 | + if ($existingSources -match [regex]::Escape($iddpUrl)) { |
| 32 | + Write-Host "IDDP NuGet source already present. Skipping add." |
| 33 | + } else { |
| 34 | + Write-Host "Adding IDDP NuGet source..." |
| 35 | + dotnet nuget add source $iddpUrl -n IDDP --configfile $configFile |
| 36 | + if (-not $?) { Write-Error "Failed to add IDDP NuGet source."; exit 1 } |
| 37 | + } |
| 38 | +
|
| 39 | + Write-Host "Final NuGet sources:" |
| 40 | + dotnet nuget list source |
| 41 | + displayName: 'Use internal IDDP NuGet feed only' |
| 42 | + |
| 43 | +- task: DotNetCoreCLI@2 |
| 44 | + displayName: 'Install wasm-tools workload' |
| 45 | + inputs: |
| 46 | + command: 'custom' |
| 47 | + custom: 'workload' |
| 48 | + arguments: 'install wasm-tools' |
| 49 | + |
| 50 | +- task: DotNetCoreCLI@2 |
| 51 | + displayName: 'Build solution (Release)' |
| 52 | + inputs: |
| 53 | + command: 'custom' |
| 54 | + custom: 'msbuild' |
| 55 | + arguments: 'Microsoft.Identity.Web.sln -r -t:build -verbosity:m -property:Configuration=Release' |
0 commit comments