From 59e07db8dcddaa7e628400fc5b1b1bae260a2a42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 13:54:15 +0000 Subject: [PATCH 1/2] Initial plan From 68c2619aad4f71dfb9438c84b8b8ce801685ec2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 14:06:42 +0000 Subject: [PATCH 2/2] Fix rebuild.ps1 script with proper restore and build steps Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com> --- .../scripts/rebuild.ps1 | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1 b/test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1 index 617538aef..9095c8b1c 100755 --- a/test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1 +++ b/test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1 @@ -17,14 +17,60 @@ Push-Location (Join-Path (Split-Path $MyInvocation.MyCommand.Path) "../") try { - dotnet tool restore; + Write-Host "Starting rebuild process..." + + # First, restore packages with error handling + Write-Host "Restoring packages..." + dotnet restore --ignore-failed-sources --property WarningsAsErrors= --property TreatWarningsAsErrors=false + if ($LASTEXITCODE -ne 0) { + Write-Error "Package restore failed" + exit $LASTEXITCODE + } + + # Build the project to ensure it compiles + Write-Host "Building project..." + dotnet build -c Debug --no-restore + if ($LASTEXITCODE -ne 0) { + Write-Error "Build failed" + exit $LASTEXITCODE + } + + # Restore dotnet tools + Write-Host "Restoring dotnet tools..." + dotnet tool restore --ignore-failed-sources + if ($LASTEXITCODE -ne 0) { + Write-Warning "Tool restore failed, trying alternative approach..." + + # Try installing EF Core tools globally as a fallback + dotnet tool install --global dotnet-ef --ignore-failed-sources + if ($LASTEXITCODE -ne 0) { + Write-Warning "Global EF tool install also failed, but continuing..." + } + } - Remove-Item (Join-Path "Migrations" "*.cs") + # Remove existing migrations + Write-Host "Removing existing migrations..." + if (Test-Path (Join-Path "Migrations" "*.cs")) { + Remove-Item (Join-Path "Migrations" "*.cs") + } + # Drop database + Write-Host "Dropping database..." dotnet ef database drop -f + if ($LASTEXITCODE -ne 0) { + Write-Warning "Database drop failed, but continuing..." + } + + # Add initial migration + Write-Host "Adding Initial migration..." dotnet ef migrations add Initial + if ($LASTEXITCODE -ne 0) { + Write-Error "Migration add failed" + exit $LASTEXITCODE + } # add using System.Collections.Generic to the migration files + Write-Host "Updating migration files..." Get-ChildItem (Join-Path "Migrations" "*.cs") | ForEach-Object { if (!( select-string -pattern "using System.Collections.Generic;" -path $_.FullName)) { @@ -33,7 +79,15 @@ try } } + # Update database + Write-Host "Updating database..." dotnet ef database update + if ($LASTEXITCODE -ne 0) { + Write-Error "Database update failed" + exit $LASTEXITCODE + } + + Write-Host "Rebuild process completed successfully!" } finally {