Skip to content

Commit 492f859

Browse files
msbuild fix
1 parent f33afb7 commit 492f859

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

.github/workflows/test.yaml

+20-6
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,50 @@ jobs:
3333
with:
3434
nuget-version: '5.x'
3535

36-
# 4. Restore Dependencies
36+
# 4. Set MSBuild Path (for .NET Framework)
37+
- name: Set MSBuild Path
38+
if: contains(matrix.framework, 'v')
39+
shell: pwsh
40+
run: |
41+
Write-Host "🔧 Setting MSBuild path for .NET Framework..."
42+
$msbuildPath = &"C:\Program Files\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
43+
if (-not $msbuildPath) {
44+
Write-Error "❌ MSBuild not found!"
45+
exit 1
46+
}
47+
Write-Host "✅ MSBuild found at: $msbuildPath"
48+
echo "MSBUILD_PATH=$msbuildPath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8
49+
50+
# 5. Restore Dependencies
3751
- name: Restore Dependencies
3852
shell: pwsh
3953
run: |
4054
Write-Host "🔄 Restoring dependencies for: ${{ matrix.framework }}"
4155
if ("${{ matrix.framework }}" -notlike "v*") { dotnet restore }
4256
if ("${{ matrix.framework }}" -like "v*") { nuget.exe restore CloudinaryDotNet.sln }
4357
44-
# 5. Build Solution
58+
# 6. Build Solution
4559
- name: Build Solution
4660
shell: pwsh
4761
run: |
4862
Write-Host "⚒️ Building for: ${{ matrix.framework }}"
4963
if ("${{ matrix.framework }}" -notlike "v*") { dotnet build --configuration Release --no-restore }
50-
if ("${{ matrix.framework }}" -like "v*") { msbuild CloudinaryDotNet.sln /p:Configuration=Release /p:TargetFrameworkVersion=${{ matrix.framework }} }
64+
if ("${{ matrix.framework }}" -like "v*") { & $env:MSBUILD_PATH CloudinaryDotNet.sln /p:Configuration=Release /p:TargetFrameworkVersion=${{ matrix.framework }} }
5165
52-
# 6. Run before_build.ps1
66+
# 7. Run before_build.ps1
5367
- name: Run before_build.ps1
5468
shell: pwsh
5569
run: . ./before_build.ps1
5670

57-
# 7. Run Unit Tests
71+
# 8. Run Unit Tests
5872
- name: Run Unit Tests
5973
shell: pwsh
6074
run: |
6175
Write-Host "🧪 Running Unit Tests for: ${{ matrix.framework }}"
6276
if ("${{ matrix.framework }}" -notlike "v*") { dotnet test "./CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj" --configuration Release --no-build }
6377
if ("${{ matrix.framework }}" -like "v*") { vstest.console.exe "./CloudinaryDotNet.Tests/bin/Release/${{ matrix.framework }}/CloudinaryDotNet.Tests.dll" /Framework:${{ matrix.framework }} }
6478
65-
# 8. Run Integration Tests
79+
# 9. Run Integration Tests
6680
- name: Run Integration Tests
6781
shell: pwsh
6882
run: |

0 commit comments

Comments
 (0)