locked
Microsoft ReportViewer Compatibility Issue with .NET 4.0 RRS feed

  • Question

  • I'm getting a run-time error when I try to run my recently-compiled web app that includes ReportViewer. It's an older app (originally developed in VS2008 or maybe earlier) and I've recompiled it in VS2010 on the .NET 4.0 platform, because that's what we're using now. Of course, I deleted the old references to Microsoft.ReportViewer.Common and Microsoft.ReportViewer.WebForms and added references to v10.0.0.0 of each assembly. The app runs perfectly in debug mode, and it compiles with no errors, but when I try to run the app, I get the following error:

    Could not load file or assembly 'SalesTool' or one of its dependencies. This
    assembly is built by a runtime newer than the currently loaded runtime and
    cannot be loaded.

    I'm thinking that the assembly that the error message is refering to is the ReportViewer because at the bottom of the error message, the version information says that the .NET version is 2.0.50727.3634. I've checked all assembly references in the project, and all are .NET 4.0 EXCEPT Microsoft.ReportViewer.Common and Microsoft.ReportViewer.WebForms, which show a runtime version of 2.050727 in the properties window. Strangely, the two ReportViewer references are v10.0.0.0 and the properties say that they're for VS2010, BUT why are the .NET runtime versions for these two assemblies 2.0?? Shouldn't they be .NET 4.0 also?

    Here's some detail about how I've tried to solve this problem so far: As I mentioned earlier, I deleted the references to the old versions of the ReportViewer assemblies, created a "lib" directory in the GAC and added the v10.0.0.0 DLLs there, and set "Copy Local" to True. Then I re-added the references to Microsoft.ReportViewer.Common and Microsoft.ReportViewer.WebForms, using the DLLs that I put into my "lib" directory. I've also deleted all files in the app's directory and recompiled.

    So I don't understand why the runtime versions of the VS2010 ReportViewer assemblies are .NET 2.0, and I really don't know how to fix this problem. I've also not found anything relevant on MSDN or beyond that would point me in the right direction for solving this problem. Any ideas?

    • Moved by Min Zhu Monday, August 20, 2012 3:16 AM (From:.NET Base Class Library)
    Thursday, August 16, 2012 5:30 PM

All replies