3

Short and plain:

is it safe to delete the contents of %SYSTEMROOT%\assembly\temp as in

rd /s "%SYSTEMROOT%\assembly\temp\*"

on a Windows Server 2008 R2 / SBS 2011 instance? Are any official documentation references or blog posts available?

In one case, I see this folder to have grown as large as 33 GB and this SE post suggests that purging the directory might be an option. In the end, it is called "temp" and apparently this folder is used for .net assembly uninstall procedures - the idea seems to be to move assembly-related files there prior to final deletion.

For one reason or the other, the final deletion is not performed on some instances and the folder keeps on growing. In the specific case I am looking at, the more than 5,600 directories under "temp" date on from May 15th, 2014, ~50 are added every day around 0:00 - 3:30 a.m. (probably as the result of some maintenance job) and each of them contains 1-2 .ni.dll file(s) like mscorlib.ni.dll, system.ni.dll, system.configuration.ni.dll [...]. This seems to repeat every day.

What I am basically looking for is either an official statement that deletion is safe or another supported and documented way to clean it up.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174

2 Answers2

1

Before you try purging this folder you have to consider that files in this folder can be used by certain .Net-applications. That being said you should check if there is any .Net application not cleaning up properly (maybe a self programmed one or a third-party-program).

You should also consider a reboot of the server because this should cause processes to end and Windows to clean that directory at least partially.

This folder can grow in size because of software-installation and -updates not cleaning up properly. However, SOME application might use files in this folder and you cannot rely on those applications to properly block the files from being deleted which can lead to malfunctions.

Purging the folder should be the last solution because it's just fighting the symptoms and not the reason that led to the folder growing that big.

Broco
  • 1,999
  • 13
  • 21
  • 1
    The server, being an SBS, is hosting Exchange, SQL Server, IIS/Sharepoint, IIS/WSUS and an AD DC role - the assemblies are mostly dependencies of these applications. The server has been rebooted - without any visible cleanup of the `assembly\temp` directory. Do you happen to have any references? – the-wabbit Aug 12 '14 at 08:58
  • Well yes, look here: http://blogs.msdn.com/b/junfeng/archive/2006/11/17/gac-temp-and-tmp.aspx As you see, temp is used to store uninstall information as well, even for updates. You CAN delete the files in there but it's the Global Assembly Cache, that means if you happen to want to delete an update later on you can run into problems because of the uninstall information not being present. What you can try is to backup this data and then delete it; if you run into problems revert the deletion. – Broco Aug 12 '14 at 13:32
  • I have seen this post. Unfortunately, neither the post itself, nor the references given therein or in the comments do make a statement about whether contents can be deleted. It is *not* the GacPath itself, BTW - this one resides in `Assembly\GAC`. It seems to be a path using by the uninstaller of assemblies for the duration of the uninstall procedure only. But I cannot find a definite statement on this, hence my question. – the-wabbit Aug 12 '14 at 15:41
  • @the-wabbit Just look which files are stored in this folder and you should see files stored in there created by updates and those are used to uninstall them. At least this is what I know about this. But you are right, it's hard to find any reference for this. – Broco Aug 12 '14 at 15:45
0

A bit late, but here's what I found. There is a utility called "gacutil.exe" that is installed with Visual Studio. According to this Microsoft doc, if you run the command gacutil /cdl , it will delete the contents of the download cache.

NOTES:

  • If you install VS 2022 Preview, the default location of the x64 files is:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\

  • Do NOT rename the file "gacutil.exe". It will fail without warning.

  • Make sure you use the correct file (x86 or x64) according to your OS.

  • gacutil.exe requires the files "gacutil.exe.config" and "gacutlrc.dll" located in the "1033" folder.

Eric
  • 1
  • 1