Skip to content

Commit f612708

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 6d2286c commit f612708

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# Working folders
1212
~build/
1313
~publish/
14+
~packages/
1415

1516
# Build results
1617
[Bb]in/

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
</PropertyGroup>
2020

2121
<PropertyGroup Label="Build">
22+
<NoWarn>NU1507</NoWarn>
2223
<IsPackable>true</IsPackable>
2324
<IsPublishable>true</IsPublishable>
2425
<ContinuousIntegrationBuild>$(TF_BUILD)</ContinuousIntegrationBuild>
26+
<ProjectName>$(MSBuildProjectName.Replace('CommunityToolkit.', ''))</ProjectName>
2527
</PropertyGroup>
2628

2729
<ItemDefinitionGroup>
@@ -33,8 +35,8 @@
3335

3436
<PropertyGroup Label="Outputs">
3537
<!-- Common Outputs -->
36-
<BuildDir>~build\</BuildDir>
37-
<PublishDir>~publish\</PublishDir>
38+
<BuildDir>$(RepositoryDirectory)~build\$(ProjectName)\</BuildDir>
39+
<PublishDir>$(RepositoryDirectory)~publish\$(ProjectName)\</PublishDir>
3840
<!-- Build Outputs -->
3941
<BaseOutputPath>$(BuildDir)bin\</BaseOutputPath>
4042
<BaseIntermediateOutputPath>$(BuildDir)obj\</BaseIntermediateOutputPath>
@@ -44,6 +46,8 @@
4446
<!-- Pack Outputs -->
4547
<PackageOutputPath>$(RepositoryDirectory)~packages\bin\</PackageOutputPath>
4648
<NuSpecOutputPath>$(RepositoryDirectory)~packages\obj\</NuSpecOutputPath>
49+
<!-- Test Outputs -->
50+
<VSTestResultsDirectory>$(BuildDir)TestResults\</VSTestResultsDirectory>
4751
</PropertyGroup>
4852

4953
</Project>

0 commit comments

Comments
 (0)