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

假如想象 提交于 2021-02-18 20:15:10

问题


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


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.




回答5:


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




回答6:


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



来源:https://stackoverflow.com/questions/19287310/winforms-could-not-load-file-or-assembly-microsoft-reportdesigner-version-10-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!