Skip to content

Commit cd49f35

Browse files
committed
Update Azure Pipelines script
- Add an MSBuild response file with basic build options. - Don't restore or build in subsequent dotnet invocations. - Use 'windows-latest' as it has been updated to 'windows-2022'. - Remove Install NuGet and NBGV install tasks as it is now built-in. - Point the 'VSTestResultsDirectory' to the new output directory 'BuildDir'.
1 parent 1195342 commit cd49f35

File tree

4 files changed

+34
-31
lines changed

4 files changed

+34
-31
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# Working folders
1515
~build/
1616
~publish/
17+
~packages/
1718

1819
# Build results
1920
[Dd]ebug/
@@ -56,7 +57,6 @@ artifacts/
5657
*.pdb
5758
*.pgc
5859
*.pgd
59-
*.rsp
6060
*.sbr
6161
*.tlb
6262
*.tli

Directory.Build.rsp

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-NoLogo
2+
-MaxCPUCount
3+
-NodeReuse:False
4+
-Verbosity:Normal

azure-pipelines.yml

+24-28
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,17 @@ pr:
99
- rel/*
1010

1111
pool:
12-
vmImage: windows-2022
12+
vmImage: windows-latest
13+
14+
variables:
15+
BuildConfiguration: Release
1316

1417
jobs:
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:

build/Community.Toolkit.Common.props

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
<IsPackable>true</IsPackable>
3131
<IsPublishable>true</IsPublishable>
3232
<ContinuousIntegrationBuild>$(TF_BUILD)</ContinuousIntegrationBuild>
33+
<ProjectName>$(MSBuildProjectName.Replace('CommunityToolkit.', ''))</ProjectName>
3334
</PropertyGroup>
3435

3536
<PropertyGroup>
3637
<!-- Common Outputs -->
37-
<BuildDir>~build\</BuildDir>
38-
<PublishDir>~publish\</PublishDir>
38+
<BuildDir>$(RepositoryDirectory)~build\$(ProjectName)\</BuildDir>
39+
<PublishDir>$(RepositoryDirectory)~publish\$(ProjectName)\</PublishDir>
3940
<!-- Build Outputs -->
4041
<BaseOutputPath>$(BuildDir)bin\</BaseOutputPath>
4142
<BaseIntermediateOutputPath>$(BuildDir)obj\</BaseIntermediateOutputPath>
@@ -45,6 +46,8 @@
4546
<!-- Pack Outputs -->
4647
<PackageOutputPath>$(RepositoryDirectory)~packages\bin\</PackageOutputPath>
4748
<NuSpecOutputPath>$(RepositoryDirectory)~packages\obj\</NuSpecOutputPath>
49+
<!-- Test Outputs -->
50+
<VSTestResultsDirectory>$(BuildDir)TestResults\</VSTestResultsDirectory>
4851
</PropertyGroup>
4952

5053
</Project>

0 commit comments

Comments
 (0)