@@ -16,22 +16,24 @@ jobs:
1616 runtime : linux-x64
1717
1818 steps :
19- - uses : actions/checkout@v3
19+ - uses : actions/checkout@v4 # 推荐升级到最新稳定版
2020
21- - name : Setup .NET SDK
22- uses : actions/setup-dotnet@v2
21+ - name : Setup .NET SDK(多版本)
22+ uses : actions/setup-dotnet@v4 # 推荐使用 v4 版本,对多SDK支持更友好
2323 with :
24- dotnet-version : ' 8.0.x'
25- dotnet-version : ' 9.0.x'
26- dotnet-version : ' 10.0.x'
24+ # 正确的数组格式:多个版本放在同一个 dotnet-version 下,用 - 前缀
25+ dotnet-version :
26+ - ' 8.0.x' # 按需添加需要的 SDK 版本
27+ - ' 9.0.x' # 你的核心 SDK 版本
2728
2829 - name : Restore dependencies
2930 run : dotnet restore ./src/c#/GeneralUpdate.sln
3031
31- - name : Check AOT compilation
32+ - name : Check AOT compilation(指定 net9.0 框架)
3233 run : |
3334 dotnet publish ./src/c#/GeneralUpdate.Client/GeneralUpdate.Client.csproj \
3435 -c Release \
36+ -f net8.0 \ # 显式指定支持 AOT 的框架,避免多框架冲突
3537 -r ${{ matrix.runtime }} \
3638 --self-contained true \
3739 -p:PublishAot=true \
@@ -42,10 +44,10 @@ jobs:
4244 - name : Verify AOT output
4345 run : |
4446 $publishDir = "./src/c#/GeneralUpdate.Client/bin/Release/net9.0/${{ matrix.runtime }}/publish"
45- if (- not (Test-Path "$publishDir/GeneralUpdate.Client.exe" -PathType Leaf) -and '${{ matrix.runtime }}' -eq 'win-x64' ) {
47+ if ($env:RUNNER_OS -eq "Windows" -and - not (Test-Path "$publishDir/GeneralUpdate.Client.exe") ) {
4648 throw "AOT compiled executable not found for Windows"
4749 }
48- if (- not (Test-Path "$publishDir/GeneralUpdate.Client" -PathType Leaf) -and '${{ matrix.runtime }}' -eq 'linux-x64' ) {
50+ if ($env:RUNNER_OS -eq "Linux" -and - not (Test-Path "$publishDir/GeneralUpdate.Client") ) {
4951 throw "AOT compiled executable not found for Linux"
5052 }
5153 shell : pwsh
0 commit comments