Save Time and Space for VS 2005 SP1 by Disabling the Patch Cache



The upcoming Visual Studio 2005 Service Pack 1 can take a while to install and can require a lot of disk installed, and even more disk space while installing the patch. You can save a little of both by disabling the Windows Installer patch caching feature.

Before doing so, understand that this patch cache contains copies of the files that were replaced by the service pack (a minor upgrade), so if you remove the cache or prevent it from being created in the first place, you will be required to have the original source media during uninstall of the service pack. Future patches may also require the original source media. If you have the disk space, it is highly recommended that you do not disable the patch cache.

If you prevent the patch cache from being written in the first place, you can save some time to install the service pack patch because of a decrease in disk I/O of about 1.3 GB when patching Visual Studio 2005 Team Suite. You can do this using the MaxPatchCacheSize system policy for Windows Installer. Because this property value may be read from an in-memory cache, it is recommended that you restart the Windows Installer service properly (never kill any msiexec.exe process as this can lead to system instability).

Consider the following basic example of a batch script:

reg export HKLMSoftwarePoliciesMicrosoftWindowsInstaller installer.reg
reg add HKLMSoftwarePoliciesMicrosoftWindowsInstaller /v MaxPatchCacheSize /t REG_DWORD /d 0 /f
net stop msiserver
start /wait VS80-KBnnnnnn-X86-mmm.exe /qn
reg delete HKLMSoftwarePoliciesMicrosoftWindowsInstaller /v MaxPatchCacheSize /f
reg import installer.reg
net stop msiserver
del /q installer.reg 2>nul

The previous policy value – if any – is backed up first before setting it to 0 to disable the patch cache. The script uses start /wait because the patch wrapper runs in the windows subsystem and will return immediately, just like msiexec.exe. You can pass additional switches after the executable such as /quiet.

Updated: to reduce time even more, install the patch silently. I changed the install command in the script above to add /qn to install silently.

Heath Stewart

Senior Software Engineer

Follow Heath   

No Comments.