Загрузка данных


# --- НАСТРОЙКИ ---
$solutionPath = "C:\ГРАВШИН ПМ\MDK_GOTCUL"
$oldName = "MDK_GOTCUL"
$newName = "МойПроект"

# --- КОД ---
Write-Host "Начинаю переименование..." -ForegroundColor Cyan
Set-Location $solutionPath

$foldersToDelete = @(".vs", "bin", "obj")
foreach ($folder in $foldersToDelete) {
    if (Test-Path $folder) { Remove-Item -Recurse -Force $folder }
}

Rename-Item -Path "$oldName.sln" -NewName "$newName.sln" -ErrorAction SilentlyContinue
Rename-Item -Path "$oldName.csproj" -NewName "$newName.csproj" -ErrorAction SilentlyContinue

Get-ChildItem -Recurse -Include *.sln, *.csproj, *.cs, *.config |
ForEach-Object {
    $content = Get-Content $_.FullName -Raw -Encoding UTF8
    if ($content -match $oldName) {
        $newContent = $content -replace $oldName, $newName
        [System.IO.File]::WriteAllText($_.FullName, $newContent, [System.Text.UTF8Encoding]($false))
    }
}

Write-Host "Готово!" -ForegroundColor Green