Recently I ran into a strange problem which took me a while to solve. In the end I was able to solve the problem and because of the limited information for my situation, I decided to write a blogpost about it.
Problem: DLL not removed from temp folder
The problem occurred with a on-premise SharePoint 2010 environment, but also occurs in higher versions. A new version of the code had to be installed on the production environment for a customer. The installation was trivial, but the first attempt resulted in a solution deployment job that hangs on “Deploying scheduled” status due to a stopped SharePoint Administration service on one of the front-end servers. Started the SharePoint Administration service, restarted the deployment and the installation successfully deploys in the farm.
A quick smoke test shows that one of the web parts was giving an error. In the ULS logs the following error occurred: “The located assembly’s manifest definition does not match the assembly reference”. A search on the internet shows several causes for this errormessage. Except the cause for my situation: the DLL ‘hangs’ in the assembly temp folder. As you can read in this blogpost from Junfeng Zhang’s Musing the GAC contains a temp and a tmp folder. The tmp folder is used for installation and the temp folder is used for uninstallation of a DLL. Due to the stopped SharePoint Administration service, the installation couldn’t be completed and the old DLL remains in the temp folder. After the second try the DLL was successfully installed in the GAC but the old DLL was still in the temp folder, which causes the assembly manifest error in the SharePoint logs.
Solution: delete the contents of the temp folder in the GAC
The issue occurred on a Windows Server 2008 R2 machine, but the solution should work as well on a Windows Server 2012 (R2) machine. To solve the issue, the DLL must be deleted from the temp folder. Do this by:
- Stopping the IIS service
- Remove the DLL from the temp folder
- Start IIS again
Tip: view the temp folder in the GAC
It’s not straightforward to navigate to these temp folders. To view the GAC temp folder you must open the assembly folder through the Run tool Win flag + R and open C:\Windows\Assembly\temp.
If you navigate via windows explorer to c:\windows\assembly you’ll only see the DLL’s and not the temp and tmp folder.
Hope to help someone with my solution and feel free to comment.