Table of Contents
What is Package Cache?
Package Cache is a system folder located on the drive where your operating system was installed. This is a global folder used by applications to store settings, caches, installers, and packages. Visual Studio is one such application that stores a large portion of its data in the Package Cache. There is no need for authentication to access these folders.
Most people consider it a bug, but these files are no bugs or errors in the applications.
Location of Package Cache Folder
The location of Package Cache folders varies from OS to OS and even from application to application. In the case of Windows, it is recommended to store those application dependent packages, settings files in the Package Cache folder, which is located as follows:
In this location, you will find plenty of subfolders related to application settings, caches, and installers of the applications. These folders are usually in an unknown hash format, and when you open them, you'll find a zip file and other unreadable files. These files can only be accessed by the application that created them.
These are the files and folders whose size is in Gigabytes.
Why Package Cache?
When you install applications such as Visual Studio, MS SQL Server Management Studio, Camtasia, and others, they reserve some space in the System Partition for their own needs, and things folder is located inside Program data and they are generally hidden to the user by default so that the user does not accidentally modify it.
You cannot change the location of Package Cache during installation, and by default, most applications store in Package Cache and then use those files in the background without giving the user any clew, and they do not require any authentication to access as they used to require for accessing other files.
If you want to uninstall, repair or update/upgrade an existing application on your computer, the application and Windows will look at those locations to see what it needs to download from the server to correct and alter the program.
The purpose of the Package Cache files/folder is to work with and improve the performance of install, update, and restore actions of the applications.
What if I remove those files and folders?
These Package Cache files may contain all of your settings and installed packages that you have created or built over time, and no one wants to delete those files and recreate the same information. Also, Microsoft doesn't recommend you to delete it as well.
It's even scarier if you delete all the files thinking they're just cache files kept by the application, and you will find your application stop functioning properly.
Also, if you deleted those files, you may not be able to uninstall the applications because the applications may be looking for something in those files/folders and not finding it, resulting in an error like this: and sometimes forcing you to reinstall your OS or restore to a previous stable state.
Also, deleting those files may cause some applications to take longer to load, process your request, and begin downloading those packages again if they do not exist on the computer.
Are they temporary files?
Ans: They are not temporary files and they contain very important data needed for the application for its operations.
How to change the location of Package Cache files?
Assuming you have a limited number of files, especially if you have an SSD, having those large package cache files/folders will fill up your SSD and it will be necessary for you to move those files/folders to separate locations.
We must move those files/folders in any drive letter in such a way that applications will automatically search for them in the new location without any problem for application.
Using mklink command
mklink command is useful command generally used for creating symbolic links. It is available to most Windows OS. Note that it will require admin privileges to run mklink command.
|/D||Creates a symbolic directory link.|
|/H||Creates a hard link|
|/J||Creates a directory junction|
|Link||New Name for Symbolic Link|
|Target||Path either relative /absolute of the new link.|
As we have enclosed paths in quotes because the link may contain a space in between them.
Here we have created symbolic links from "C:\ProgramData\PackageCache" to "D:\BackupCache\ProgramData\PackageCache". Now programs which have package cache in "C:\ProgramData\PackageCache" package cache then next time it will search it at "D:\BackupCache\ProgramData\PackageCache"
And you will get success message like:
Do package cache files get deleted after I uninstalled Visual Studio?
Ans: In my case, I have uninstalled Visual Studio IDE, even though those package cache files referring to the visual studio are not deleted.
How to disable package cache?
You can start the installer with the —nocache switch before installing, modifying or repairing Visual Studio or other products with the new installer. (source)
This procedure will remove any existing packages for the Visual Studio product and will prevent any packages from being saved after they have been installed.
If you alter or repair Visual Studio and require packages, they will be installed. They are downloaded automatically and removed once they have been installed from that location.