Skip to content

Instantly share code, notes, and snippets.

@blair55
Created August 3, 2015 18:25
Show Gist options
  • Save blair55/9410c8ee1e22f0feaa91 to your computer and use it in GitHub Desktop.
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
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