Mengosongkan 50-100 GB: Panduan Lengkap Pembersihan Disk untuk Developer .NET, Game, dan Desktop
Setiap pengembang perangkat lunak dan game di Windows pasti pernah mengalami pagi yang genting: Anda menyalakan PC, membuka IDE, dan tiba-tiba Windows memberi peringatan—SSD NVMe 1 TB Anda hanya tersisa kurang dari 2 GB ruang bebas.
Anda tidak mengunduh video berukuran besar atau memasang game baru berukuran 100 GB. Ke mana semua kapasitas penyimpanan itu menghilang?
Sebagai developer game indie dan aplikasi desktop lintas platform yang bekerja dengan .NET 8/9, MonoGame, Android, serta Windows Application Packaging (MSIX/WAP untuk Microsoft Store), saya menelusuri krisis penyimpanan ini. Melalui pemindaian otomatis pada repositori proyek, ditemukan bahwa lebih dari 68 GB dihabiskan semata-mata oleh sisa kompilasi sementara, arsip paket rilis lama, dan cache paket NuGet.
Dalam panduan ini, kami membedah alasan teknis di balik penumpukan ruang tersebut, menjelaskan mengapa menghapus folder-folder ini 100% aman, serta menyediakan skrip PowerShell dan Batch otomatis siap pakai untuk memulihkan puluhan gigabyte secara instan.
1. Anatomi Penumpukan Ruang Disk Developer
Saat mengompilasi solusi lintas platform, compiler dan alat pengemasan menduplikasi biner perantara dan aset di setiap tahapan:
flowchart TD
subgraph "Ruang Kerja Proyek"
Code["Kode Sumber (.cs, .xaml, .json)\n(Terlindungi - Beberapa MB)"]
Assets["Aset Asli (PNG, OGG, Shaders)\n(Terlindungi)"]
Git["Riwayat .git\n(Terlindungi)"]
BinObj["Folder bin dan obj\n(DLL perantara, simbol, salinan)\n[30 - 60 GB]"]
AppPackages["WAP / MSIX AppPackages\n(Paket rilis store lama)\n[5 - 20 GB]"]
end
subgraph "Cache Sistem & Global"
NuGet["%USERPROFILE%\\.nuget\\packages\n(Cache Global NuGet)\n[10 - 20 GB]"]
Temp["%LOCALAPPDATA%\\Temp\n(File sementara kompilator)\n[3 - 10 GB]"]
end
style BinObj fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px,color:#fff
style AppPackages fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px,color:#fff
style NuGet fill:#ff922b,stroke:#d9480f,stroke-width:2px,color:#fff
style Temp fill:#ff922b,stroke:#d9480f,stroke-width:2px,color:#fff
Penyebab A: Folder bin dan obj (30 - 60+ GB)
obj/(Keluaran Perantara): Menyimpan status kompilasi inkremental. Untuk proyek Android, folder ini dapat membengkak hingga 3-6 GB per proyek.bin/(Keluaran Biner): Berisi file eksekusi dan semua aset yang disalin melalui<CopyToOutputDirectory>. Jika 10 proyek mereferensikan folder konten game 500 MB yang sama, aset tersebut digandakan 10 kali (menghamburkan 5 GB).
Penyebab B: Folder AppPackages Microsoft Store (5 - 20+ GB)
Setiap kali membuat paket rilis, Visual Studio menghasilkan file .msixbundle dan .msixupload (lengkap dengan simbol PDB). Visual Studio tidak pernah menghapus versi lama secara otomatis.
Penyebab C: Cache Global NuGet (10 - 20+ GB)
Di %USERPROFILE%\.nuget\packages, tersimpan setiap versi pustaka yang pernah diunduh di komputer Anda.
Penyebab D: File Sementara Windows (Temp) (3 - 10 GB)
Ribuan file sisa kompilasi dan ekstraksi yang tertinggal di %LOCALAPPDATA%\Temp.
2. Jaminan Keamanan: Mengapa 100% Bebas Risiko?
| Terlindungi (TIDAK PERNAH Dihapus) | Aman Dihapus (100% Dapat Dibuat Ulang) |
|---|---|
Kode Sumber: .cs, .xaml, .cpp, .json |
File objek perantara kompilator (obj/) |
Definisi Proyek: .sln, .csproj, .wapproj |
Biner dan dependensi hasil kompilasi (bin/) |
Repositori Git: Folder .git/, commit, branch |
Paket rilis Microsoft Store lama (AppPackages/) |
| Aset Asli: Tekstur, audio, model, shader | Paket unduhan NuGet dalam cache (.nuget\packages) |
Sertifikat: .pfx, StoreAssociation.xml |
File sementara sistem operasi (%LOCALAPPDATA%\Temp) |
Apa yang terjadi saat membuka kembali Visual Studio?
Saat Anda membuka solusi dan mengeklik Build atau Rebuild, Visual Studio dan .NET SDK akan otomatis membuat ulang folderbindanobjsecara bersih dari kode sumber. Tidak ada progres kerja yang hilang.
3. Solusi Otomatisasi: Skrip Pembersih
Mesin Skrip PowerShell (Clean-DevDiskSpace.ps1)
Simpan di folder _tools/Clean-DevDiskSpace.ps1 pada direktori proyek Anda:
<#
.SYNOPSIS
Alat Pembersih Ruang Disk untuk Developer
#>
[CmdletBinding()]
param (
[switch]$Force,
[switch]$ScanOnly,
[switch]$SkipNuget,
[switch]$SkipTemp,
[string]$RootPath = ""
)
if ([string]::IsNullOrWhiteSpace($RootPath)) {
if ($PSScriptRoot) { $RootPath = (Join-Path $PSScriptRoot "..") } else { $RootPath = Get-Location }
}
$resolvedRoot = (Resolve-Path $RootPath -ErrorAction SilentlyContinue).Path
if ([string]::IsNullOrWhiteSpace($resolvedRoot) -or $resolvedRoot -in @("C:\", "C:", "\", "/")) {
Write-Host "PENGAMAN AKTIF: Jalur root terdeteksi, operasi dibatalkan!" -ForegroundColor Red
exit 1
}
$systemDrive = Get-PSDrive -Name C
$freeGBBefore = [math]::Round($systemDrive.Free / 1GB, 2)
Write-Host "Ruang bebas saat ini di C: $freeGBBefore GB" -ForegroundColor Yellow
$binObjDirs = Get-ChildItem -Path $resolvedRoot -Recurse -Directory -Force -ErrorAction SilentlyContinue |
Where-Object { $_.Name -in @('bin', 'obj') }
$appPackageDirs = Get-ChildItem -Path $resolvedRoot -Recurse -Directory -Filter "AppPackages" -Force -ErrorAction SilentlyContinue
if ($ScanOnly) { Write-Host "Mode pemindaian selesai." -ForegroundColor Yellow; return }
if (-not $Force) {
$prompt = Read-Host "Mulai pembersihan aman? (Y/N)"
if ($prompt -notin @('Y', 'y')) { return }
}
$binObjDirs | ForEach-Object { try { Remove-Item -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue } catch {} }
$appPackageDirs | ForEach-Object { try { Remove-Item -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue } catch {} }
if (-not $SkipTemp) { Get-ChildItem -Path [System.IO.Path]::GetTempPath() -Force -ErrorAction SilentlyContinue | ForEach-Object { try { Remove-Item -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue } catch {} } }
if (-not $SkipNuget) { try { $null = dotnet nuget locals all --clear 2>&1 } catch {} }
$freeGBAfter = [math]::Round((Get-PSDrive -Name C).Free / 1GB, 2)
$freedTotal = [math]::Round($freeGBAfter - $freeGBBefore, 2)
Write-Host "`nPEMBERSIHAN SELESAI! Ruang berhasil dipulihkan: +$freedTotal GB" -ForegroundColor Green
Peluncur Batch (clean-disk-space.bat)
@echo off
setlocal
title Workspace Disk Cleanup
cd /d "%~dp0"
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0_tools\Clean-DevDiskSpace.ps1" %*
pause
4. Hasil Uji Lapangan Nyata
- Ruang Bebas Sebelum Pembersihan: 1,35 GB (Peringatan merah kritis)
- Ruang Bebas Setelah Pembersihan: 53,80 GB
- Total Ruang yang Dipulihkan: +52,45 GB dalam waktu kurang dari 3 menit.
Tentang Arar Games & Game Kami
Jelajahi game indie kami dan terhubung dengan studio kami:
- 🌐 Situs Resmi: https://www.mayhemcorporation.com
🎮 Game Kami
- Blocked: Pixel Panzer: Pertempuran tank arkade retro dengan cuaca dinamis & pertarungan bos epik.
Google Play (Android & PC) - PaintTrek: Teka-teki warna cerah dan aksi mewarnai piksel kreatif.
Google Play | Microsoft Store (PC & Xbox) - Space Dodger: Game penghindaran rintangan luar angkasa arkade retro berkecepatan tinggi.
Google Play
📱 Media Sosial Resmi
- 🎵 TikTok: https://www.tiktok.com/@arargamesstudio
- 📸 Instagram: https://www.instagram.com/arargamesstudio
- 🐦 X (Twitter): https://x.com/arargamesstudio
- 📺 YouTube: https://www.youtube.com/@koreaaria
- 🧵 Threads: https://www.threads.net/@arargamesstudio
- 📘 Facebook: https://www.facebook.com/arargamesstudio