Created
August 3, 2015 18:25
-
-
Save blair55/9410c8ee1e22f0feaa91 to your computer and use it in GitHub Desktop.
Clear ReSharper (8.2) Solution Cache for a repo from the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CurrentRepoName(){ | |
$repoPath = git rev-parse --show-toplevel | |
$repoName = basename $repoPath | |
return $repoName | |
} | |
function ClearReSharperSolutionCache(){ | |
$repoName = Get-CurrentRepoName | |
$rootPath = $env:localappdata + "\JetBrains\ReSharper\v8.2\SolutionCaches\" | |
$folders = get-childitem $rootPath | |
$exp = "_Resharper\." + $repoName + "\.-?\d+" | |
$found = $FALSE | |
foreach ($folder in $folders) { | |
if($folder -match $exp){ | |
$found = $TRUE | |
$fullPath = $rootPath + $folder | |
Try | |
{ | |
remove-item $fullPath -recurse -confirm -errorAction Stop | |
} | |
Catch | |
{ | |
write-warning "Please close Visual Studio running $repoName" | |
} | |
} | |
} | |
if(!($found)){ | |
write-warning "No ReSharper cache found for $repoName" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment