.net – ASP.NET 2.0 “BC2017: could not find library” – How to force .NET to look for correct version

.netasp.net-2.0

A precompiled ASP.NET 2.0 (Visual Studio 2005) application is throwing this error when we try to access it.

Compiler Error Message: BC2017: could not find library 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll'

Two immediate problems spring to mind:

  1. We're running .NET version 2.0.50727, not 2.0.0.0
  2. Our GAC is located at "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files," not "C:\WINDOWS\assembly\GAC_MSIL\"

So obviously it's looking for an outdated version of the assembly and it's looking for it in the wrong place.

Unfortunately, we can't recompile the application because we're hosting it for a client and the source code can't be obtained from the original developer. Is there any way to force the ASP.NET application to use the current version of System.Web.Mobile.dll and whatever other standard .NET assemblies it needs?

We will of course lecture them the perils of paying developers and not getting the source code, but we'd sure like to help them get this thing running until they can replace it.

Edit: It turns out that the problem was due to some disk corruption that affected the GAC. Now we're having some other .NET problems related to rebuilding the GAC, but that's another story. Closing this question.

Best Solution

If you put the DLL's it's looking for in the same folder as the application itself, it should look there first before falling back to the versions in the GAC

EDIT: Just discovered http://www.dll-files.com/. You can check to see id they have the correct version of your DLL