Is purging %SYSTEMROOT%\assembly\temp safe?

6,246

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.

Share:
6,246

Related videos on Youtube

the-wabbit
Author by

the-wabbit

Updated on September 18, 2022

Comments

  • the-wabbit
    the-wabbit almost 2 years

    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
    the-wabbit almost 10 years
    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?
  • Broco
    Broco almost 10 years
    Well yes, look here: blogs.msdn.com/b/junfeng/archive/2006/11/17/… 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.
  • the-wabbit
    the-wabbit almost 10 years
    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.
  • Broco
    Broco almost 10 years
    @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.