Is there a possibility to remove the old versions of installation packages from the layout folder of Visual Studio 2017 offline installation? This folder needs a lot of memo
After you perform layout updates to an offline cache, the layout cache folder may have some obsolete packages that are no longer needed by the latest Visual Studio installation. You can use the
--clean
option to remove obsolete packages from an offline cache folder.
Microsft Docs: How to remove older versions from a layout
I had created a small utility application for deleting old version folders from Visual Studio 2017 offline setup.
You can download the source from GitHub at https://github.com/deepak-rathi/VS2017OfflineSetupUtility
Or
Run the executable VS2017OfflineSetupUtility.exe from Release folder
https://github.com/deepak-rathi/VS2017OfflineSetupUtility/tree/master/VS2017OfflineSetupUtility/bin/Release
You can use the new --clean
option. You'll need the file path(s) to catalog manifest(s) that contain those obsolete packages. You can find the catalog manifests in an Archive
folder in the offline layout cache.
They are saved there when you update a layout. In the "Archive" folder, there is one or more GUID
named folders, each of which contains an obsolete catalog manifest. The number of GUID
folders should be the same as the number of updates made to your offline cache.
A few files are saved inside each GUID
folder. The two files of most interest are a catalog.json
file and a version.txt
file. The catalog.json
file is the obsolete catalog manifest you'll need to pass to the --clean
option. The version.txt
file contains the version of this obsolete catalog manifest. Based on the version number, you can decide whether you want to remove obsolete packages from this catalog manifest. You can do the same as you go through the other GUID
folders. After you make the decision on the catalog(s) you want to clean, run the --clean command by supplying the files paths to these catalogs.
Examples:
vs_enterprise.exe --layout <layoutDir> --clean <file-path-of-catalog1> <file-path-of-catalog2> …
vs_enterprise.exe --layout <layoutDir> --clean <file-path-of-catalog1> --clean <file-path-of-catalog2> …
You can also invoke vs_enterprise.exe
inside the <layoutDir>.
Here's an example:
c:\VS2017Layout\vs_enterprise.exe --layout c:\VS2017Layout --clean c:\VS2017Layout\Archive\1cd70189-fc55-4583-8ad8-a2711e928325\Catalog.json --clean c:\VS2017Layout\Archive\d420889f-6aad-4ba4-99e4-ed7833795a10\Catalog.json
When you execute this command, Setup analyzes your offline cache folder to find the list of files that it will remove. You will then have a chance to review the files that are going to be deleted and confirm the deletions.