# Clean Up ASP.NET and Visual Studio Cache and Temp Files

## Description

**Visual Studio** leaves a lot of temporary files over a few locations on your hard drive. Some of the temporarily files are not actually temporary and the same should be cleaned up time to time.

Depending on the versions of **Visual Studio**, **.NET framework**, and the operation system the specific path to the temp folders and files may vary.

  

## Solution

Below you can find the common places where the unneeded temp files are stored so you can clean them up.

> note For better reusability, all localization paths in this article start with a default [Windows Environment Path Variable](https://docs.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables)(%\[VARIABLE]%).

> caption Temporary ASP.NET Files

The temporary files generated by Visual Studio after creating and running an ASP.NET application reside in:

```
%SYSTEMROOT%\Microsoft.NET\Framework[64]\<vernum>\Temporary ASP.NET Files folder.
```

> note The folders and files under this folder can be removed with no harm to your development computer. Do not remove the "Temporary ASP.NET Files" folder itself, just the folders underneath this folder. If you use IIS for ASP.NET development, you may need to run the iisreset.exe utility from the command prompt prior to deleting any files/folder under this folder. IIS will sometimes keep files in use in this folder and iisreset will release the locks so the files/folders can be deleted.

> caption Website Cache

This folder is located in each users local settings folder:

```
%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
```

> caption Visual Studio Backup

```
%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\BackupFiles
```

The Visual Studio backup folder never gets cleaned out automatically, so you should periodically delete all files and folders under this directory.

> caption Project Assemblies

```
 %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\[version number e.g. 17.0_e7f7d5e5]]\ProjectAssemblies
```

Such a folder is created for each project you have worked on.

> caption Assembly Cache

```
%USERPROFILE%\AppData\Local\assembly\dl3
```

This folder is normally associated with WPF or Silverlight development so the same might not exist on your machine.

## Common Errors Related to Cached or Temp Files

* [Error Creating Control - Telerik control 'Property' cannot be initialized. Details: Unable to cast object of type 'Type' to type 'Type'.](https://www.telerik.com/products/aspnet-ajax/documentation/knowledge-base/telerik-undefined-iis7-integrated-mode#design-time-error-on-a-page-using-telerik-controls)

* [Could not load file or assembly](https://www.telerik.com/products/aspnet-ajax/documentation/knowledge-base/common-how-to-fix-license-file-related-errors#could-not-load-file-or-assembly)

## See Also

* [ASP.NET Temporary files cleanup](https://stackoverflow.com/questions/16137457/asp-net-temporary-files-cleanup)

* [InvalidCastException on displaying RadGrid in designer](https://www.telerik.com/forums/invalidcastexception-on-displaying-radgrid-in-designer)
