Back in 2016, I developed my first free app for Microsoft .NET developers. Its purpose was to help address some common issues that developers face, and since then, I’ve continued to add new features and functionality.
The app’s initial release included a feature to delete temporary and cached files that Visual Studio and SQL Server don’t clean up on their own. This can help prevent issues like failed builds or debugging errors caused by cluttered files.
Another useful feature I added was the ability to quickly scan a computer for source code and back it up. This was motivated by my frustration with source control programs that occasionally lose code, and it’s proven to be a valuable tool for many developers.
Now, with this third major version, I’ve converted the app into a Microsoft .NET global tool. This provides improved performance and makes it easy to call from a command line, making it a great addition to build scripts or pre/post-build events in Visual Studio.
As always, I’m committed to making this tool even more useful for developers in the future. If you have any suggestions or feedback on how I can continue to improve it, please don’t hesitate to let me know.
Demo
Here is a demo of the tool in action!

Clean Folders
If you’re experiencing unexplained build or testing issues with your code, the clean function in this tool can help. This feature quickly cleans up temporary and cached folders on your computer (including those listed below), which can often be the cause of such problems.
In addition to fixing these issues, the clean function provides another benefit: it can free up gigabytes of space on your computer drives. You can also add any folder on your computer to be cleaned, giving you complete control over what’s deleted.
On my development machine, this feature is capable of deleting over 3,757 files per second, providing fast and effective cleanup. So if you’re struggling with mysterious issues in your code, give the clean function a try and see if it helps resolve the problem.
The Commands
Command | Description |
clean | Cleans the configured folders (see list below). Errors will be reported at the end of the run. |
clean –af|--addfolder <folder name> | Enables a folder to be cleaned. |
clean –rf|--removefolder <folder name> | Disables a folder from being cleaned. |
clean --nuget | Will clean the NuGet package cache (not yet implemented) |
clean –projects | Will clean the bin and obj folders from projects (not yet implemented) |
Examples
spargine clean
spargine clean --af c:temp
spargine clean --rf c:temp
If you want a folder permanently added to this default list, please email me and I will add it to the next version!
Have you ever encountered strange errors or failures in your Visual Studio projects, even though you’ve done everything correctly? That’s where the clean command comes in. It can quickly fix issues that you might not even know existed, such as unit test failures or build errors caused by outdated cached files. For instance, I once encountered 206 unit test failures after getting the latest files from source control. However, after running clean, I ran the unit tests again and got zero failures. Another time, after updating all NuGet packages in a solution, it wouldn’t build anymore. But after running Spargine, the solution built fine!
Code Backup
This tool’s backup command makes it easy to quickly back up your Visual Studio project code files. This feature is particularly useful when retrieving code from a source control repository, as it ensures that you have a backup copy of your files in case of any issues.
When you trigger the first backup, and then every 7 days (by default), the tool will scan all the drives on your computer for source code. For each folder it finds, you’ll be prompted to add it to the backup process.
Depending on the amount of source code you have on your computer, backing up files may take some time. To speed up the process, we’ve included a “turbo backup” feature that only backs up files with the archive flag set.
By default, the tool backs up files to your OneDrive folder, ensuring that they’re stored safely in the cloud. If OneDrive isn’t installed on your computer, the default location for backups is C:\Users<user>\AppData\Local\Spargine\Backup
. The tool automatically removes any backup folders that are older than 7 days, keeping your backups up-to-date and tidy.
Command | Description |
backup | Scans your computer for source code and copies them to a backup folder. |
backup --turbo | Enables the turbo mode for quick backups. |
backup –af|--addfolder <folder name> | Adds a folder to be backed up. |
backup –rf|--removefolder <folder name> | Removes a folder to be backed up. |
backup --bf|--backupfolder <folder name> | Sets the location of the backup folder. (not yet implemented) |
Examples
spargine backup
spargine backup --turbo
spargine backup --af c:\temp
spargine backup --rf c:\temp
spargine backup –-bf c:\backup
Installation
To install, simply open a command window and type:
dotnet tool install --global dotNetTips.Spargine.Dev.Tool
To remove, in the command window, type:
dotnet tool uninstall --global dotNetTips.Spargine.Dev.Tool
To update, in the command window, type:
dotnet tool update dotnet tool uninstall --global dotNetTips.Spargine.Dev.Tool
For the complete information go to: https://www.nuget.org/packages/dotNetTips.Spargine.Dev.Tool/
Future Work
Before you ask, here are features that I will be adding to this tool soon.
Clean Folders
- Adding Folders: I will add to the –af|–addfolder command the ability to set:
- Clean files older than x days.
- Remove the folder after cleaning.
- When scanning folders, allow that search to be recursive. This is enabled by default.
- Search pattern.
- Clean the NuGet package cache.
- Remove bin and obj folders from projects. This can clean up build and debugging issues.
Code Backup
- Adding Folders: I will add to the –af|–addfolder command to add and remove folders to be backed up. This will also allow the following to be set for these folders:
- Files older than x days.
- When scanning folders, allow the search to be recursive. This is enabled by default.
- Search pattern.
- Add file types to ignore. Currently, the default is: aps, bak, cache, cachefile, csdef, dbmdl, dll, docstates, dotCover, gpState, JustCode, ncb, nupkg, opendb, opensdf, optpfx, plg,props, psess, publishproj, publishsettings, pubxml, sap, schemaview, sdf, snk, suo, targets, temp, tmp, user, userosscache, userprefs, vsp, vssscc, vspscc, vspx, zip, pdb, compiled, rsp
- Add the ability to ignore the same file types in the .gitignore file.
- The ability to set the backup folder location.
Folders That Will Be Cleaned
Currently, the folders that will be automatically cleaned are:
- CodeRush Logs
- Crypnet URL Cache – C:Users<user>AppDataLocalLowMicrosoftCryptnetUrlCache
- IIS Express Logs – C:Users<user>OneDriveDocumentsIISExpressLogs
- Isolated Storage – C:Users<user>AppDataLocalIsolatedStorage
- Local Assemblies – C:Users<user>AppDataLocalassembly
- McAfee Logs Example
- Microsoft Caches – C:Users<user>AppDataLocalMicrosoftCaches
- NuGet Cache – C:Users<user>AppDataLocalNuGetv3-cache
- SQL Server Management backup folders – C:Users<user>OneDriveDocumentsSQL Server Management StudioBackup Files
- SQL Server temporary folders
- Submain Cache
- Temporary ASP.NET folders – C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
- User Local Temp folder – C:Users<user>AppDataLocalTemp
- Visual Studio Application Insights – C:Users<user>AppDataLocalMicrosoftVSApplicationInsights
- Visual Studio Backup Folders
- Visual Studio Component Model Cache – C:Users<user>AppDataLocalMicrosoftVisualStudio16.0_8319667aComponentModelCache
- Visual Studio Project Assemblies – C:Users<user>AppDataLocalMicrosoftVisualStudioProjectAssemblies
- Visual Studio Services – C:UsersdavidAppDataLocalMicrosoftVisual Studio Services
- Visual Studio/ GitHub Blob Cache – C:Users<user>AppDataLocalGitHubVisualStudioBlobCache
- Visual Studio/ GitHub GraphQL Cache – C:Users<user>AppDataLocalGitHubVisualStudioGraphQLCache
- Website Cache – C:Users<user>AppDataLocalMicrosoftWebsiteCache
Summary
I hope that the Spargine Global App will help you and your team since I use it every day! Do you have a feature idea, or issue with the app? Please email me at dotNetDave@live.com.
Happy Coding Geeks!