@@ -27,11 +27,11 @@ jobs:
2727 with :
2828 fetch-depth : 0
2929
30- - name : Setup .NET
31- uses : actions /setup-dotnet@v4
32- with :
33- dotnet-version : |
34- 4.8.0
30+ - name : Setup MSBuild
31+ uses : microsoft /setup-msbuild@v2
32+
33+ - name : Setup NuGet
34+ uses : NuGet/setup-nuget@v2
3535
3636 - name : Cache NuGet packages
3737 uses : actions/cache@v4
@@ -41,39 +41,43 @@ jobs:
4141 restore-keys : |
4242 ${{ runner.os }}-nuget-
4343
44- - name : Restore dependencies
45- run : dotnet restore
44+ - name : Restore NuGet packages
45+ run : nuget restore
4646
4747 - name : Build solution
48- run : dotnet build --configuration ${{ matrix.configuration }} --no-restore --verbosity minimal
48+ run : msbuild /p:Configuration= ${{ matrix.configuration }} /p:Platform="Any CPU" /verbosity: minimal
4949
5050 - name : Run tests (if any)
5151 run : |
5252 if (Test-Path "**/*Tests*.csproj") {
53- dotnet test --configuration ${{ matrix.configuration }} --no-build --verbosity minimal --logger trx --collect:"XPlat Code Coverage"
53+ # Use VSTest for .NET Framework projects
54+ vstest.console.exe **/*Tests*/bin/${{ matrix.configuration }}/**/*Tests*.dll
5455 } else {
5556 Write-Host "No test projects found - skipping tests"
5657 }
5758 shell : pwsh
5859 continue-on-error : true
5960
60- - name : Publish application
61- if : matrix.configuration == 'Release'
62- run : |
63- dotnet publish --configuration Release --no-build --output ./publish --self-contained true --runtime win-x64
64-
6561 - name : Create portable package
6662 if : matrix.configuration == 'Release'
6763 run : |
68- Compress-Archive -Path "./publish/*" -DestinationPath "./AutoBSPpackingTool-${{ github.ref_name }}-win-x64.zip"
64+ # Find the main executable output directory
65+ $outputPath = Get-ChildItem -Path . -Recurse -Directory -Name "bin" | Where-Object { $_.Contains("Release") } | Select-Object -First 1
66+ if ($outputPath) {
67+ $fullPath = Get-ChildItem -Path $outputPath -Recurse -Filter "*.exe" | Select-Object -First 1 | Split-Path -Parent
68+ Compress-Archive -Path "$fullPath/*" -DestinationPath "./AutoBSPpackingTool-${{ github.ref_name }}-win-x64.zip"
69+ }
6970 shell : pwsh
7071
7172 - name : Upload build artifacts
7273 if : matrix.configuration == 'Release'
7374 uses : actions/upload-artifact@v4
7475 with :
7576 name : AutoBSPpackingTool-${{ github.ref_name }}-win-x64
76- path : ./publish/
77+ path : |
78+ **/bin/Release/**/*.exe
79+ **/bin/Release/**/*.dll
80+ **/bin/Release/**/*.config
7781 retention-days : 30
7882
7983 release :
@@ -85,18 +89,26 @@ jobs:
8589 - name : Checkout code
8690 uses : actions/checkout@v4
8791
88- - name : Setup .NET
89- uses : actions/setup-dotnet@v4
90- with :
91- dotnet-version : 4.8.0
92+ - name : Setup MSBuild
93+ uses : microsoft/setup-msbuild@v2
9294
93- - name : Build and publish release
94- run : |
95- dotnet publish --configuration Release --output ./release --self-contained true --runtime win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
95+ - name : Setup NuGet
96+ uses : NuGet/setup-nuget@v2
97+
98+ - name : Restore NuGet packages
99+ run : nuget restore
100+
101+ - name : Build release
102+ run : msbuild /p:Configuration=Release /p:Platform="Any CPU" /verbosity:minimal
96103
97104 - name : Create release package
98105 run : |
99- Compress-Archive -Path "./release/*" -DestinationPath "./AutoBSPpackingTool-${{ github.ref_name }}-win-x64.zip"
106+ # Find the main executable output directory
107+ $outputPath = Get-ChildItem -Path . -Recurse -Directory -Name "bin" | Where-Object { $_.Contains("Release") } | Select-Object -First 1
108+ if ($outputPath) {
109+ $fullPath = Get-ChildItem -Path $outputPath -Recurse -Filter "*.exe" | Select-Object -First 1 | Split-Path -Parent
110+ Compress-Archive -Path "$fullPath/*" -DestinationPath "./AutoBSPpackingTool-${{ github.ref_name }}-win-x64.zip"
111+ }
100112 shell : pwsh
101113
102114 - name : Create GitHub Release
@@ -120,17 +132,18 @@ jobs:
120132 with :
121133 fetch-depth : 0
122134
123- - name : Setup .NET
124- uses : actions/setup-dotnet@v4
125- with :
126- dotnet-version : 4.8.0
135+ - name : Setup MSBuild
136+ uses : microsoft/setup-msbuild@v2
137+
138+ - name : Setup NuGet
139+ uses : NuGet/setup-nuget@v2
127140
128- - name : Restore dependencies
129- run : dotnet restore
141+ - name : Restore NuGet packages
142+ run : nuget restore
130143
131144 - name : Run code analysis
132145 run : |
133- dotnet build --configuration Release -- verbosity minimal --warnaserror
146+ msbuild /p:Configuration=Release /p:Platform="Any CPU" / verbosity: minimal /p:TreatWarningsAsErrors=true
134147
135148 - name : Security scan
136149 uses : securecodewarrior/github-action-add-sarif@v1
0 commit comments