Cannot Load File Or Assembly After Renaming DLL

Solution

Use an Elephant gun.

Details

DDK renamed one of our DLLs from AgentMaintenance.dll to CompanyMaintenance.dll. After my next ‘Get Latest’ from our source code repository the solution failed to build saying ‘Could not load file or assembly AgentMaintenance’. No-one else in the project team was getting this error. It was obviously a conspiracy.

I did the following:

  • Searched through all References in my Visual Studio Projects looking for AgentMaintenance
  • Deleted everything in Temporary ASP.NET Files folder
  • Deleted all obj and bin files from my main project
  • Courtesy of Eric Falston, I stopped the World Wide Web Publishing Service, closed Visual Studio then re-opened Visual Studio and re-started the Service (this worked once).
  • Commenced video and phone surveillance of my workmates.

None of this solved the Assembly loading issue but the dossier on my Brazilian workmate proved to have significant omissions.

Returning to the issue at hand, DDK suggested using ‘Find In Files’ in Notepad++ to look for occurences of AssetMaintenance and I found a few in intruiging locations such as a Subversion .tmp file, the Visual Studio .suo file and a redundant project, AgentMaintenance.Persistence, which was no longer part of our VS solution.

I deleted the SVN .tmp file and the .suo file and the solution successfully built (once). Thereafter I found that deleting the .suo file after every build would allow the solution to load and run succesfully without compaining that it could not load AgentMaintenance.dll.

This kept me happy for a while as I reasoned I could find the real problem at a later time instead of just dealing with the problem symptomatically by deleting the suo file prior to each build. But then IT DIDN”T WORK. Not even deleting the .suo file could prevent the Godzilla-like re-emergence of “Cannot Load file or assembly…”

So, finally, and not before time, I pulled out the Elephant gun.

KER-BLAM! I exterminated my SVN Working Copy, did a clean SVN Checkout and re-built successfully. 1,000 builds later Godzilla still sleeps.

If the above doesn’t help, try this very informative thread.

PS
For astounding video footage of what is possible with half a lobster, twelve cubic yards of Helio brand ball-bearings and a rubber mallet, please contact Blog Author and quote BRAZIL-808-MA.
Caution: Some scenes may disturb younger viewers

Advertisements

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: