Skip to content

Commit cfb40d8

Browse files
azchohfiCopilot
andauthored
Updated to .Net 10, and enabled native aot/single file. (#133)
* Updated to .Net 10, and enabled native aot/single file. * Fixed tests. * Simplified build. * Fix cross compilation for arm64. * Updated dependencies. * Update all dependencies to their latest versions - Identity: Microsoft.Identity.Client / .Broker / .Extensions.Msal 4.85.2 -> 4.86.1 - Extensions: Microsoft.Extensions.* 10.0.9 -> 10.0.10 - SkiaSharp (+ NativeAssets.Linux/macOS) 4.148.0 -> 4.150.1 - System.CommandLine 2.0.9 -> 2.0.10, Spectre.Console 0.57.1 -> 0.57.2 - Meziantou.Framework.Win32.CredentialManager 2.0.2 -> 3.0.1 - Nerdbank.GitVersioning 3.10.85 -> 3.10.91 - Test stack: MSTest.Sdk / MSTest.* 4.2.3 -> 4.3.2, Microsoft.NET.Test.Sdk 18.0.1 -> 18.8.1, Testing.Extensions.CodeCoverage 18.8.0 -> 18.9.0, Testing.Extensions.TrxReport 2.2.3 -> 2.3.2 Replace FluentAssertions 7.2.0 with AwesomeAssertions 9.5.0. FluentAssertions 8+ moved to a commercial license; AwesomeAssertions is the Apache-2.0 community fork. Updated the global using in Usings.cs from FluentAssertions to AwesomeAssertions (its 9.x root namespace); the 178 assertion call sites are otherwise unchanged. Validated: solution builds clean (0 warnings), all unit tests pass on net10.0 and net10.0-windows, and the win-x64 Native AOT single-file publish succeeds and runs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5eef89d-c576-4c40-85ad-79f16260e9e2 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5eef89d-c576-4c40-85ad-79f16260e9e2
1 parent 36aee26 commit cfb40d8

29 files changed

Lines changed: 258 additions & 421 deletions

.github/workflows/build.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010
branches: [ "main" ]
1111

1212
jobs:
13-
build-nuget-and-tests:
14-
name: Build Nuget and Run Tests
13+
build-and-test:
14+
name: Build and Run Tests
1515
strategy:
1616
fail-fast: false
1717
matrix:
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup .NET
2727
uses: actions/setup-dotnet@v6
2828
with:
29-
dotnet-version: 9.0.x
29+
dotnet-version: 10.0.x
3030
- name: Install and Configure Keyring
3131
if: ${{ matrix.os == 'ubuntu-latest' }}
3232
run: |
@@ -43,19 +43,19 @@ jobs:
4343
run: dotnet restore MSStore.CLI.sln /p:Configuration=Release
4444
- name: Build
4545
run: dotnet build MSStore.CLI.sln --no-restore /p:Configuration=Release
46-
- name: Test net9.0
47-
run: dotnet run --project MSStore.CLI.UnitTests -f net9.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
48-
- name: Test net9.0-windows10.0.17763.0
46+
- name: Test net10.0
47+
run: dotnet run --project MSStore.CLI.UnitTests -f net10.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
48+
- name: Test net10.0-windows10.0.17763.0
4949
if: ${{ matrix.os == 'windows-latest' }}
50-
run: dotnet run --project MSStore.CLI.UnitTests -f net9.0-windows10.0.17763.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
50+
run: dotnet run --project MSStore.CLI.UnitTests -f net10.0-windows10.0.17763.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
5151
- name: Publish test results
5252
if: ${{ !cancelled() }}
5353
uses: actions/upload-artifact@v7
5454
with:
5555
name: test-results-${{ matrix.os }}
5656
path: TestResults/*.trx
5757
- name: Install ReportGenerator
58-
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.4.11
58+
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.5.1
5959
- name: Merge code coverage files
6060
run: reportgenerator "-reports:${{ github.workspace }}/**/*.cobertura.xml" "-targetdir:${{ github.workspace }}/report" "-reporttypes:Cobertura" "-filefilters:-*GenerationContext*.g.cs"
6161
- name: Publish code coverage results
@@ -64,15 +64,6 @@ jobs:
6464
name: Cobertura-${{ matrix.os }}
6565
path: ${{ github.workspace }}/report/Cobertura.xml
6666
# TODO: Publish github comment with code coverage
67-
- name: Pack NuGet
68-
if: ${{ matrix.os == 'ubuntu-latest' }}
69-
run: dotnet pack MSStore.API --no-build -c Release
70-
- name: Upload Artifact - NuGet
71-
if: ${{ matrix.os == 'ubuntu-latest' }}
72-
uses: actions/upload-artifact@v7
73-
with:
74-
name: NuGet
75-
path: MSStore.API/bin/Release/*.nupkg
7667

7768
build-cli:
7869
strategy:
@@ -84,13 +75,13 @@ jobs:
8475
include:
8576
- os: windows-latest
8677
dotnet-os: win
87-
dotnet-framework: net9.0-windows10.0.17763.0
78+
dotnet-framework: net10.0-windows10.0.17763.0
8879
- os: ubuntu-latest
8980
dotnet-os: linux
90-
dotnet-framework: net9.0
81+
dotnet-framework: net10.0
9182
- os: macos-latest
9283
dotnet-os: osx
93-
dotnet-framework: net9.0
84+
dotnet-framework: net10.0
9485
runs-on: ${{ matrix.os }}
9586

9687
name: Build CLI - ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
@@ -102,20 +93,25 @@ jobs:
10293
- name: Setup .NET
10394
uses: actions/setup-dotnet@v6
10495
with:
105-
dotnet-version: 9.0.x
96+
dotnet-version: 10.0.x
10697
- name: Add msbuild to PATH
10798
if: ${{ matrix.os == 'windows-latest' }}
10899
uses: microsoft/setup-msbuild@v3
109100
- name: Install NBGV tool
110101
run: dotnet tool install --tool-path . nbgv
111102
- name: Set Version
112103
run: ./nbgv cloud
113-
- name: Restore CLI
114-
run: dotnet restore MSStore.CLI -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} /p:Configuration=Release /p:PublishReadyToRun=true
115-
- name: Build CLI
116-
run: dotnet build MSStore.CLI --no-restore --no-self-contained -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} -f ${{ matrix.dotnet-framework }} /p:Configuration=Release
104+
- name: Install linux-arm64 NativeAOT toolchain
105+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.dotnet-arch == 'arm64' }}
106+
run: |
107+
sudo apt-get update
108+
sudo apt-get install -y \
109+
clang llvm lld \
110+
binutils-aarch64-linux-gnu \
111+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
112+
libc6-dev-arm64-cross
117113
- name: Publish SelfContained CLI
118-
run: dotnet publish MSStore.CLI --no-build --no-self-contained -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} -f ${{ matrix.dotnet-framework }} /p:Configuration=Release /p:PublishProfile=${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
114+
run: dotnet publish MSStore.CLI --self-contained -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} -f ${{ matrix.dotnet-framework }} /p:Configuration=Release /p:PublishProfile=${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
119115
- run: |
120116
New-Item -ItemType File -Path ".\MSStore.CLI.MSIX\obj\${{ matrix.dotnet-arch }}\appxmanifest.xml" -Force
121117
Copy-Item ".\MSStore.CLI.MSIX\Package.appxmanifest" -Destination ".\MSStore.CLI.MSIX\obj\${{ matrix.dotnet-arch }}\appxmanifest.xml" -Force

.pipelines/build.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ parameters:
1616
type: object
1717
default:
1818
- Release
19-
- name: buildPlatforms
20-
type: object
21-
default:
22-
- x64
23-
- arm64
2419
- name: pools
2520
type: object
2621
default:
@@ -49,7 +44,7 @@ extends:
4944
credscan:
5045
suppressionsFile: '$(System.DefaultWorkingDirectory)/.pipelines/CredScanSuppressions.json'
5146
binSkim:
52-
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net9.0\MSStore.API.dll'
47+
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net10.0\MSStore.API.dll'
5348
stages:
5449
- stage: Build_And_Run_CodeQL
5550
jobs:
@@ -63,17 +58,15 @@ extends:
6358
steps:
6459
- checkout: self
6560
- task: UseDotNet@2
66-
displayName: Setup .NET 9
61+
displayName: Setup .NET 10
6762
inputs:
68-
version: 9.0.x
63+
version: 10.0.x
6964
- script: mv -f $(Build.SourcesDirectory)/.pipelines/release-nuget.config ./nuget.config
7065
displayName: Add release package source
7166
- task: NuGetAuthenticate@1
7267
- script: dotnet restore MSStore.CLI.sln /p:Configuration=${{ dotnet_config }}
7368
displayName: Restore dependencies
74-
- template: ./.pipelines/templates/build-nuget.yaml@self
69+
- template: ./.pipelines/templates/build-and-tests.yaml@self
7570
parameters:
7671
dotnet_configuration: ${{ dotnet_config }}
77-
AgentOS: $(Agent.OS)
78-
DoEsrp: false
79-
signingIdentity: {}
72+
AgentOS: $(Agent.OS)

.pipelines/code-inspector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extends:
3535
credscan:
3636
suppressionsFile: '$(System.DefaultWorkingDirectory)/.pipelines/CredScanSuppressions.json'
3737
binSkim:
38-
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net9.0\MSStore.API.dll'
38+
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net10.0\MSStore.API.dll'
3939
stages:
4040
- stage: codeInspector
4141
displayName: Code Inspector

.pipelines/release.yml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ parameters:
4040
image: windows-latest
4141
os: windows
4242
dotnet_runtime: win
43-
dotnet_framework: net9.0-windows10.0.17763.0
43+
dotnet_framework: net10.0-windows10.0.17763.0
4444
- name: Azure-Pipelines-1ESPT-ExDShared
4545
image: ubuntu-latest
4646
os: linux
4747
dotnet_runtime: linux
48-
dotnet_framework: net9.0
48+
dotnet_framework: net10.0
4949
- name: Azure Pipelines
5050
image: macos-latest
5151
os: macOS
5252
dotnet_runtime: osx
53-
dotnet_framework: net9.0
53+
dotnet_framework: net10.0
5454

5555
name: 0.0.$(Date:yyMM).$(Date:dd)$(Rev:rr)
5656

@@ -69,51 +69,36 @@ extends:
6969
credscan:
7070
suppressionsFile: '$(System.DefaultWorkingDirectory)/.pipelines/CredScanSuppressions.json'
7171
binSkim:
72-
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net9.0\MSStore.API.dll'
72+
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net10.0\MSStore.API.dll'
7373
stages:
74-
- stage: NuGet
74+
- stage: Build_And_Tests
7575
jobs:
7676
- ${{ each pool in parameters.pools }}:
7777
- ${{ each dotnet_config in parameters.dotnet_configurations }}:
78-
- job: Build_Nuget_And_Tests_${{ pool.os }}_${{ dotnet_config }}
79-
displayName: Build Nuget and Run Tests (${{ pool.os }}_${{ dotnet_config }})
78+
- job: Build_And_Tests_${{ pool.os }}_${{ dotnet_config }}
79+
displayName: Build and Run Tests (${{ pool.os }}_${{ dotnet_config }})
8080
pool:
8181
name: ${{ pool.name }}
8282
image: ${{ pool.image }}
8383
os: ${{ pool.os }}
8484
steps:
8585
- checkout: self
8686
- task: UseDotNet@2
87-
displayName: Setup .NET 9
87+
displayName: Setup .NET 10
8888
inputs:
89-
version: 9.0.x
90-
- ${{ if eq(parameters.DoEsrp, 'true') }}:
91-
- task: UseDotNet@2
92-
displayName: Setup .NET 6.0 (For ESRP Task)
93-
condition: startsWith(variables['Agent.OS'], 'Linux')
94-
inputs:
95-
packageType: runtime
96-
version: 6.0.x
89+
version: 10.0.x
9790
- script: mv -f $(Build.SourcesDirectory)/.pipelines/release-nuget.config ./nuget.config
9891
displayName: Add release package source
9992
- task: NuGetAuthenticate@1
10093
- script: dotnet restore MSStore.CLI.sln /p:Configuration=${{ dotnet_config }}
10194
displayName: Restore dependencies
102-
- template: ./.pipelines/templates/build-nuget.yaml@self
103-
parameters:
104-
dotnet_configuration: ${{ dotnet_config }}
105-
AgentOS: $(Agent.OS)
106-
DoEsrp: ${{ parameters.DoEsrp }}
107-
signingIdentity: ${{ parameters.signingIdentity }}
108-
- template: ./.pipelines/templates/pack-nuget.yaml@self
95+
- template: ./.pipelines/templates/build-and-tests.yaml@self
10996
parameters:
11097
dotnet_configuration: ${{ dotnet_config }}
11198
AgentOS: $(Agent.OS)
112-
DoEsrp: ${{ parameters.DoEsrp }}
113-
signingIdentity: ${{ parameters.signingIdentity }}
11499

115100
- stage: CLI
116-
dependsOn: NuGet
101+
dependsOn: Build_And_Tests
117102
jobs:
118103
- ${{ each pool in parameters.pools }}:
119104
- ${{ each dotnet_config in parameters.dotnet_configurations }}:
@@ -128,9 +113,9 @@ extends:
128113
- checkout: self
129114
persistCredentials: true
130115
- task: UseDotNet@2
131-
displayName: Setup .NET 9
116+
displayName: Setup .NET 10
132117
inputs:
133-
version: 9.0.x
118+
version: 10.0.x
134119
- ${{ if eq(parameters.DoEsrp, 'true') }}:
135120
- task: UseDotNet@2
136121
displayName: Setup .NET 6.0 (For ESRP Task)
@@ -150,7 +135,7 @@ extends:
150135
xmlTargetFiles: ''
151136
xmlTransformationRules: ''
152137
- task: NuGetAuthenticate@1
153-
- script: dotnet restore MSStore.CLI -r ${{ pool.dotnet_runtime }}-${{ platform }} /p:Configuration=${{ dotnet_config }} /p:PublishReadyToRun=true
138+
- script: dotnet restore MSStore.CLI -r ${{ pool.dotnet_runtime }}-${{ platform }} /p:Configuration=${{ dotnet_config }}
154139
displayName: Restore CLI
155140
- template: ./.pipelines/templates/build-cli.yaml@self
156141
parameters:
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
parameters:
2+
- name: dotnet_configuration
3+
type: object
4+
default:
5+
- Release
6+
- name: AgentOS
7+
type: string
8+
default: ''
9+
10+
steps:
11+
- bash: |
12+
echo "##vso[task.setvariable variable=AgentOS;]${{ parameters.AgentOS }}"
13+
- script: |
14+
sudo apt-get update
15+
sudo apt-get install -y gnome-keyring dbus-x11
16+
eval "$(dbus-launch --sh-syntax)"
17+
echo "##vso[task.setvariable variable=DBUS_SESSION_BUS_ADDRESS;]$DBUS_SESSION_BUS_ADDRESS"
18+
export $(echo 'anypass_just_to_unlock' | gnome-keyring-daemon --unlock)
19+
export $(echo 'anypass_just_to_unlock' | gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
20+
condition: startsWith(variables.AgentOS, 'Linux')
21+
displayName: Install and Configure Keyring
22+
env:
23+
DISPLAY: :0.0
24+
- task: DotNetCoreCLI@2
25+
inputs:
26+
command: custom
27+
custom: tool
28+
arguments: install --tool-path . nbgv
29+
displayName: Install NBGV tool
30+
- script: ./nbgv cloud
31+
condition: startsWith(variables.AgentOS, 'Darwin')
32+
displayName: Set Version MacOS
33+
- script: nbgv cloud
34+
condition: not(startsWith(variables.AgentOS, 'Darwin'))
35+
displayName: Set Version
36+
- script: dotnet build MSStore.CLI.sln --no-restore /p:Configuration=${{ parameters.dotnet_configuration }}
37+
displayName: Build
38+
- task: DotNetCoreCLI@2
39+
displayName: 'Tests net10.0'
40+
env:
41+
DISPLAY: :0.0
42+
inputs:
43+
command: 'run'
44+
projects: '**/*[Tt]est*/*.csproj'
45+
arguments: '-f net10.0 --no-build -c ${{ parameters.dotnet_configuration }} --coverage --coverage-output-format cobertura --report-trx'
46+
- task: DotNetCoreCLI@2
47+
displayName: 'Tests net10.0-windows10.0.17763.0'
48+
condition: startsWith(variables.AgentOS, 'Windows_NT')
49+
env:
50+
DISPLAY: :0.0
51+
inputs:
52+
command: 'run'
53+
projects: '**/*[Tt]est*/*.csproj'
54+
arguments: '-f net10.0-windows10.0.17763.0 --no-build -c ${{ parameters.dotnet_configuration }} --coverage --coverage-output-format cobertura --report-trx'
55+
- task: PublishTestResults@2
56+
inputs:
57+
testResultsFormat: 'VSTest'
58+
testResultsFiles: '$(Build.SourcesDirectory)/MSStore.CLI.UnitTests/**/TestResults/*.trx'
59+
- task: DotNetCoreCLI@2
60+
displayName: 'Install ReportGenerator'
61+
inputs:
62+
command: custom
63+
custom: tool
64+
arguments: 'install --global dotnet-reportgenerator-globaltool --version 5.5.1'
65+
- script: reportgenerator "-reports:$(Build.SourcesDirectory)/**/*.cobertura.xml" "-targetdir:$(Build.SourcesDirectory)/report" "-reporttypes:Cobertura" "-filefilters:-*GenerationContext*.g.cs"
66+
displayName: Merge code coverage files
67+
- task: PublishCodeCoverageResults@1
68+
displayName: 'Publish code coverage results'
69+
inputs:
70+
codeCoverageTool: 'Cobertura'
71+
summaryFileLocation: '$(Build.SourcesDirectory)/report/Cobertura.xml'
72+
- task: ComponentGovernanceComponentDetection@0
73+
displayName: 'Component Governance Detection'
74+
inputs:
75+
ignoreDirectories: $(Build.SourcesDirectory)/MSStore.CLI.UnitTests/TestData,$(Build.SourcesDirectory)/MSStore.CLI.UnitTests/bin

.pipelines/templates/build-cli.yaml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,8 @@ steps:
2828
- script: nbgv cloud
2929
condition: not(startsWith(variables.AgentOS, 'Darwin'))
3030
displayName: Set Version
31-
- script: dotnet build MSStore.CLI --no-restore --no-self-contained -r ${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }} -f ${{ parameters.dotnet_framework }} /p:Configuration=${{ parameters.dotnet_configuration }}
32-
displayName: Build CLI
33-
- task: DownloadPipelineArtifact@2
34-
inputs:
35-
buildType: 'current'
36-
artifactName: 'NuGetDLLs'
37-
targetPath: '$(System.DefaultWorkingDirectory)/MSStore.CLI/bin/${{ parameters.dotnet_configuration }}/${{ parameters.dotnet_framework }}/${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }}'
38-
- script: dotnet publish MSStore.CLI --no-build --no-self-contained -r ${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }} -f ${{ parameters.dotnet_framework }} /p:Configuration=${{ parameters.dotnet_configuration }} /p:PublishProfile=${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }}
39-
displayName: Publish NoSelfContained CLI
31+
- script: dotnet publish MSStore.CLI --self-contained -r ${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }} -f ${{ parameters.dotnet_framework }} /p:Configuration=${{ parameters.dotnet_configuration }} /p:PublishProfile=${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }}
32+
displayName: Publish CLI
4033
- ${{ if eq(parameters['DoEsrp'], 'true') }}:
4134
- task: EsrpCodeSigning@5
4235
displayName: Code Sign ESRP - CLI - 3rd Party Dependencies
@@ -50,9 +43,8 @@ steps:
5043
AuthSignCertName: ${{ parameters.signingIdentity.signCertName }}
5144
FolderPath: '$(System.DefaultWorkingDirectory)/MSStore.CLI/bin/${{ parameters.dotnet_configuration }}/${{ parameters.dotnet_framework }}/${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }}/publish'
5245
Pattern: |
53-
Meziantou.Framework.Win32.CredentialManager.dll,
54-
Spectre.Console.dll,
55-
SkiaSharp.dll,
46+
libSkiaSharp.dll,
47+
msalruntime_${{ parameters.dotnet_arch }}.dll,
5648
signConfigType: inlineSignParams
5749
inlineOperation: |
5850
[
@@ -91,12 +83,6 @@ steps:
9183
FolderPath: '$(System.DefaultWorkingDirectory)/MSStore.CLI/bin/${{ parameters.dotnet_configuration }}/${{ parameters.dotnet_framework }}/${{ parameters.dotnet_runtime }}-${{ parameters.dotnet_arch }}/publish'
9284
Pattern: |
9385
msstore.exe
94-
msstore.dll
95-
MSStore.API.dll
96-
Microsoft.*.dll
97-
!Microsoft.Windows.SDK.NET.dll
98-
System.CommandLine*.dll
99-
!System.CommandLine.resources.dll
10086
UseMinimatch: true
10187
signConfigType: inlineSignParams
10288
inlineOperation: |

0 commit comments

Comments
 (0)