$projectFiles = Get-ChildItem -Path "C:\TFS Fideuram\TP_SEI_Project" -Filter "*.csproj" -Recurse

foreach ($projectFile in $projectFiles) {
    $content = Get-Content $projectFile.FullName -Raw
    if ($content -match '<TargetFrameworkVersion>v4\.[0-6]</TargetFrameworkVersion>') {
        Write-Host "Updating $($projectFile.FullName)"
        $updatedContent = $content -replace '<TargetFrameworkVersion>v4\.[0-6]</TargetFrameworkVersion>', '<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>'
        Set-Content -Path $projectFile.FullName -Value $updatedContent -NoNewline
    }
}