Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Winforms Could not load file or assembly 'Microsoft.ReportDesigner, Version=10.0.0.0' in VS2012

This is driving me nuts. I have a winforms app build in VS2012 targeting .NET 4.5. On a few forms I have to use a ReportViewer. At first I worked with ReportViewer for 2012 (version 11.0.0.0). All working fine. However, my client doesn't want to install this version on their workstations yet because this version uses the CLR Types SQL 2012. Don't ask me why, but I have to accept this for now.

So I decided to use the previous reportviewer version 10.0.0.0. I downloaded the redistributional package and installed it. I also added it to my toolbox in VS2012 and deleted the reportviewer dll's already referenced in my project. But when I drag a version 10 reportviewer on my form I get the following error:

Could not load file or assembly 'Microsoft.ReportDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The application IS running without errors, but I have no design-time support on the forms using this reportviewer control, as you can see in the image. I would like to get rid of the error.

enter image description here

I checked the GAC and could not find the mentioned Microsoft.ReportDesigner. It is there for version 9.0.0.0 and 11.0.0.0 but not for 10.0.0.0.

Bottom line, how can I use the ReportViewer version 10.0.0.0 in design time in VS2012 without the problem of the design-time error?

Framework: .NET 4.5 App Type : winforms Language : vb.net Visual Studio: Version 2012 Control: ReportViewer 10.0.0.0 SP 1

P.S. I also tested the ReportViewer control in VS2010, there is no problem using it in design time in VS2010.

[UPDATE]

The exact error when I try to add the ReportViewer on my form in VS2012 is:

enter image description here

like image 416
Stephan Avatar asked Oct 10 '13 04:10

Stephan


People also ask

Where to find Microsoft ReportViewer WebForms dll?

So please make sure that in C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer\ (it is VS2010) folder has Microsoft. ReportViewer. Common. dll and make sure the folder (C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer\) exists in your machine.


Video Answer


2 Answers

I had the same problem. I was able to fix VS 2012 designer with the following workaround. I doubt this is the correct way, but it helps and I did not find anything better for now.

  1. Close Visual Studio 2012

  2. Go to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies folder and copy all report viewer assemblies (file names are starting with "Microsoft.ReportDesigner." and version is 10.0.0.0) to the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies. Backup it before doing this.

  3. Start Visual Studio 2012 and open your project.

like image 70
Alex Kryvdyk Avatar answered Sep 20 '22 16:09

Alex Kryvdyk


Alex's solution is wrong, it works but not right.

Simply solution is replacing old refence with current version's dll

I've removed removed reference Microsoft.ReportViewer.WinForms then added reference Microsoft.ReportViewer.WinForms which version is v11.0.0.0

Hope it helps.

like image 41
lomec Avatar answered Sep 19 '22 16:09

lomec