Skip to content

Commit d0c17d1

Browse files
Update build.yml to build on Windows
Got an error when trying to build on linux
1 parent 70a1285 commit d0c17d1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88
jobs:
99
build:
1010
name: Build and analyze
11-
runs-on: ubuntu-latest
11+
runs-on: windows-latest # <-- Changed from ubuntu-latest to windows-latest
1212
env:
13-
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
13+
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
1414
SONAR_SCANNER_PROJECT_KEY: SupportTeam-SC-demos_kilo-cppAndcSharp
1515
steps:
1616
- uses: actions/checkout@v4
@@ -32,15 +32,19 @@ jobs:
3232
env:
3333
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3434
run: |
35-
dotnet-sonarscanner begin \
36-
/k:"${{ env.SONAR_SCANNER_PROJECT_KEY }}" \
37-
/o:"supportteam-sc-demos" \
38-
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
35+
dotnet-sonarscanner begin `
36+
/k:"${{ env.SONAR_SCANNER_PROJECT_KEY }}" `
37+
/o:"supportteam-sc-demos" `
38+
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" `
3939
/d:sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
4040
41+
- name: Setup MSBuild
42+
uses: microsoft/setup-msbuild@v2 # <-- Add this step
43+
4144
- name: Build Solution with Build Wrapper
4245
run: |
43-
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} dotnet build CPlusPlusAndCSharp.sln --no-incremental
46+
build-wrapper-win-x86-64 --out-dir $env:BUILD_WRAPPER_OUT_DIR msbuild CPlusPlusAndCSharp.sln /p:Configuration=Release
47+
shell: pwsh # Use PowerShell for Windows
4448

4549
- name: SonarScanner for .NET - End
4650
env:

0 commit comments

Comments
 (0)