99- rel/*
1010
1111pool :
12- vmImage : windows-2022
12+ vmImage : windows-latest
13+
14+ variables :
15+ BuildConfiguration : Release
1316
1417jobs :
1518- job : BuildBits
19+ displayName : Build and Test solution
1620 timeoutInMinutes : 60
1721 steps :
1822
19- # Install NuGet
20- - task : NuGetToolInstaller@0
21- displayName : Install NuGet 6.0
22- inputs :
23- versionSpec : 6.0.0
24-
25- # Install NerdBank GitVersioning
26- - task : DotNetCoreCLI@2
27- displayName : Install NBGV tool
28- inputs :
29- command : custom
30- custom : tool
31- arguments : update -g nbgv
32-
3323 # Set Build Version
3424 - script : nbgv cloud
3525 displayName : Set NBGV version
@@ -38,35 +28,41 @@ jobs:
3828 - pwsh : build/Update-Headers.ps1 -Verify
3929 displayName : Verify headers
4030
31+ # Restore solution
32+ - script : dotnet restore -p:Configuration=$(BuildConfiguration)
33+ displayName : Restore solution
34+
4135 # Build solution
42- - script : dotnet build -c Release
36+ - script : dotnet build --no-restore -c $(BuildConfiguration)
4337 displayName : Build solution
4438
45- # Run .NET 6 tests
46- - script : dotnet test -c Release -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
39+ # Test solution #
40+
41+ # Run .NET 6 unit tests
42+ - script : dotnet test --no-build -c $(BuildConfiguration) -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
4743 displayName : Run .NET 6 unit tests
4844
49- # Run .NET Core 3.1 tests
50- - script : dotnet test -c Release -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
45+ # Run .NET Core 3.1 unit tests
46+ - script : dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
5147 displayName : Run .NET Core 3.1 unit tests
5248
53- # Run .NET Framework 4.7.2 tests
54- - script : dotnet test -c Release -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
49+ # Run .NET Framework 4.7.2 unit tests
50+ - script : dotnet test --no-build -c $(BuildConfiguration) -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
5551 displayName : Run .NET Framework 4.7.2 unit tests
5652
5753 # Publish test results
5854 - task : PublishTestResults@2
5955 displayName : Publish test results
6056 inputs :
61- testResultsFormat : ' VSTest'
62- testResultsFiles : ' **/ VSTestResults*.trx'
57+ testResultsFormat : VSTest
58+ testResultsFiles : ~build/*/TestResults/ VSTestResults*.trx
6359 condition : always()
6460
65- # Create the NuGet package(s)
66- - script : dotnet pack -c Release
67- displayName : Create NuGet package(s)
61+ # Pack solution
62+ - script : dotnet pack --no-build -c $(BuildConfiguration)
63+ displayName : Pack solution
6864
69- # Sign package(s)
65+ # Sign packages
7066 - pwsh : build/Sign-Package.ps1
7167 displayName : Authenticode sign packages
7268 env :
0 commit comments