99- rel/*
1010
1111pool :
12- vmImage : windows-2022
12+ vmImage : windows-latest
13+
14+ variables :
15+ Build.Configuration : Release
1316
1417jobs :
1518- job : BuildBits
19+ displayName : Build and Test solution
1620 timeoutInMinutes : 60
1721 steps :
1822
19- # Install the .NET Core 3.1 SDK
20- - task : UseDotNet@2
21- displayName : Install the .NET Core 3.1 SDK
22- inputs :
23- version : 3.1.x
24-
25- # Install the .NET 6 SDK
26- - task : UseDotNet@2
27- displayName : Install the .NET 6 SDK
28- inputs :
29- version : 6.0.x
30-
3123 # Install the .NET 7 SDK
3224 - task : UseDotNet@2
3325 displayName : Install the .NET 7 SDK
3426 inputs :
3527 version : 7.0.x
3628 includePreviewVersions : true
37-
38- # Install NuGet
39- - task : NuGetToolInstaller@0
40- displayName : Install NuGet 6.0
41- inputs :
42- versionSpec : 6.0.0
43-
44- # Install NerdBank GitVersioning
45- - task : DotNetCoreCLI@2
46- displayName : Install NBGV tool
47- inputs :
48- command : custom
49- custom : tool
50- arguments : update -g nbgv
29+ performMultiLevelLookup : true
5130
5231 # Set Build Version
5332 - script : nbgv cloud
@@ -57,42 +36,48 @@ jobs:
5736 - pwsh : build/Update-Headers.ps1 -Verify
5837 displayName : Verify headers
5938
39+ # Restore solution
40+ - script : dotnet restore -p:Configuration=$(Build.Configuration)
41+ displayName : Restore solution
42+
6043 # Build solution
61- - script : dotnet build -c Release
44+ - script : dotnet build --no-restore -c $(Build.Configuration)
6245 displayName : Build solution
6346
64- # Run .NET 6 tests
65- - script : dotnet test -c Release -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
47+ # Test solution #
48+
49+ # Run .NET 6 unit tests
50+ - script : dotnet test --no-build -c $(Build.Configuration) -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
6651 displayName : Run .NET 6 unit tests
6752
68- # Run .NET Core 3.1 tests
69- - script : dotnet test -c Release -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
53+ # Run .NET Core 3.1 unit tests
54+ - script : dotnet test --no-build -c $(Build.Configuration) -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
7055 displayName : Run .NET Core 3.1 unit tests
7156
72- # Run .NET Framework 4.7.2 tests
73- - script : dotnet test -c Release -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
57+ # Run .NET Framework 4.7.2 unit tests
58+ - script : dotnet test --no-build -c $(Build.Configuration) -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
7459 displayName : Run .NET Framework 4.7.2 unit tests
7560
7661 # Publish test results
7762 - task : PublishTestResults@2
7863 displayName : Publish test results
7964 inputs :
80- testResultsFormat : ' VSTest'
81- testResultsFiles : ' **/VSTestResults*.trx'
65+ testResultsFormat : VSTest
66+ testResultsFiles : ' **/TestResults/ VSTestResults*.trx'
8267 condition : always()
8368
84- # Create the NuGet package(s)
85- - script : dotnet pack -c Release
86- displayName : Create NuGet package(s)
69+ # Pack solution
70+ - script : dotnet pack --no-build -c $(Build.Configuration)
71+ displayName : Pack solution
8772
88- # Sign package(s)
73+ # Sign packages
8974 - pwsh : build/Sign-Package.ps1
9075 displayName : Authenticode sign packages
9176 env :
9277 SignClientUser : $(SignClientUser)
9378 SignClientSecret : $(SignClientSecret)
9479 ArtifactDirectory : bin/nupkg
95- condition : and(succeeded(), not(eq( variables['Build.Reason'], 'PullRequest')), not(eq( variables['SignClientSecret '], '')), not(eq( variables['SignClientUser '], '') ))
80+ condition : and(succeeded(), ne( variables['Build.Reason'], 'PullRequest'), ne( variables['SignClientUser '], ''), ne( variables['SignClientSecret '], ''))
9681
9782 # Publish build artifacts
9883 - publish : bin/nupkg
0 commit comments