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

6

13

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

Nanette answered 10/10, 2013 at 4:50 Comment(2)
The biggest mystery to me is how you managed to add it to the toolbox. The redist package is only intended to get ReportViewer on a client machine, it doesn't provide the reference assemblies. That you can't find it in the GAC is otherwise easy to explain, you are probably looking at the wrong one. It gets added to the v2 GAC, not the v4 GAC. Look in c:\windows\assembly. Add more info your question about where you found the reference assemblies, that's the step that went wrong.Sodamide
Adding to the toolbox was easy. When selecting items just go to the Reportviewer.Winforms.dll. Then it appears in the toolbox. However you can only use one of the reportviewers. Either the version which comes with VS2012 or the VS2010. As far as the question on the GAC, I checked C:\windows\assembly. I got a version 9.0.0.0 and 11.0.0.0. not a version 10.0.0. But we go an other route now. So solving this is not the highest Prio anymore. Thx for the reply, I'm still curious how to solve it anyway. ;-)Nanette
S
11

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.

Shotgun answered 27/10, 2013 at 14:4 Comment(4)
Alex's answer worked for me, but doesn't this mean we are now running with the old version of the control? Will this cause any issues?Polson
There is also another solution, which is contrary to the previous, copy Report Viewer 11 controls from C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies. This also helps, and as far as I understand you'll end up with designer version 11.Shotgun
Why not just reference the correct version of ReportViewer that the version of Visual Studio expects, you just update the references manually - from the respective directories as per the bug report: connect.microsoft.com/VisualStudio/feedback/details/607566/… - Not a good idea to copy PrivateAssemblies to different versions...Mate
If you do this, before you do it, make a backup copy of the V. 11 files you will be replacing. Then you can restore them if needed. Also, it would be better to create batch files to switch between versions by copying the appropriate version in on-demand (still restarting VS). Then, the best thing is to always leave the original files in that directory, by copying back in the version 11 files after you are done with every editing session. If your boss suddenly borrows your machine, it won't screw them up, invoking their ire.Acetic
W
8

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.

Wishbone answered 20/1, 2014 at 14:51 Comment(1)
This is a good solution. if you are prepared to upgrade from v10.0.0.0 to v11.0.0.0 . Version 11 works fine.Dagan
P
2

Alex's fix works, but you end up in the previous version of the control. To get the v11 of the report viewer control, close your project if it is open then browse to c:\windows\assembly. Copy the public key token's value for the Microsoft.ReportViewer.Common.Resource version 11.0.0.0. Open your project file and search for the reference to the 10.0.0.0 version of the ReportViewer. Change the version to 11.0.0.0 and the public key to the value you copied and then save the file. Once you open the project, the ReportViewer reference should be pointing to the correct version.

Polson answered 6/11, 2013 at 20:47 Comment(0)
E
2

Got the answer from CodeProject (see link below)

It doesn't need a license, it's a Redistributable

2008 http://www.microsoft.com/en-us/download/details.aspx?id=6576[^]

2010 http://www.microsoft.com/en-us/download/details.aspx?id=6442[^]

http://www.codeproject.com/Questions/399003/Could-not-load-file-or-assembly-Microsoft-ReportVi

Elburr answered 7/4, 2014 at 5:9 Comment(0)
M
0

upload the the dll in your site bin

from this window folder(C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer). i ve used it and it work Microsoft.ReportViewer.Common.dll Microsoft.ReportViewer.WebForms.dll Microsoft.ReportViewer.WinForms.dll

Meander answered 23/9, 2017 at 13:39 Comment(0)
E
0

add reference with following path: C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\12.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.Common.dll

C:\Program Files (x86)\Microsoft Visual Studio 14.0\ReportViewer\Microsoft.ReportViewer.WinForms.dll

Expel answered 5/11, 2017 at 10:12 Comment(1)
This doesn't look like version 10.0.0.0, but rather 12.0.0.0.Acetic

© 2022 - 2024 — McMap. All rights reserved.