Compiler Error Message: BC2017: could not find library

One of my web apps uses SQL Server Reporting Services, and began throwing this error the other day:

Compiler Error Message: BC2017: could not find library ‘c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\…’

The file name in the path refers to a temporary file with a random name.

Last time I saw a similar error message, the permissions on the Temporary ASP.NET Files folder needed to be modified.  I was using impersonation, and the impersonated user needed MODIFY permissions.  It didn’t make sense in this case, since we hadn’t made any changes and weren’t using impersonation.

Just to be sure, we added the ASPNET user with Modify permissions, and the report ran!  As an experiment, we removed the ASPNET user, and the report sill ran!  This made no sense, so I hunted down the network manager to see what MS update may have been installed on my web server.  Instead, they had decommissioned the old primary domain controller, and promoted a newer BDC to become the PDC.  This web server is Windows 2000 (and is to be replaced this year), and our guess is that IIS was using a token cached from the old PDC, which wasn’t validating against the new PDC.

Whatever the case, tweaking the permissions worked.  In other cases, you may need to leave the impersonated user assigned to the folder.  This is usually the case when you try and access the report for the first time.

DotNetKicks Image

Error: Could not load file or assembly ‘Microsoft.ReportViewer.WebForms, Version=9.0.0.0

The full error reads:



Parser Error Message: Could not load file or assembly ‘Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.


This error means you’re using the SQL Server Reporting Services ReportViewer control in your web application, and the server can’t find the proper DLL.  All you have to do is deploy them to your server.  With Visual Studio 2008, the location of the ReportViewer DLLs has changed.  You now find them at C:\Program Files\Microsoft Visual Studio 9.0\ReportViewer.


The first way to get these on your server, and this only works if you run your own server, is to directly copy them into the C:\Windows\assembly folder, and reboot the server (this reloads the GAC).  If a reboot is out of the question, you can use GACUTIL.EXE to copy and register the DLLs.


If you’re in a shared hosting environment, reference the DLLs from the VS 9 path listed above, and set the Copy Local=True (select the DLL and open the Properties tab).  This will copy the DLLs into your applications BIN folder, and look for them there first.  You can then deploy to a shared host, making sure to copy all the contents of BIN.