1
votes

I can't resolve this exception message, please help me.

Failed to create component 'ReportViewer'.

The error message follows:

'System.InvalidCastException: [A]Microsoft.Reporting.WinForms.ReportViewer cannot be cast to [B]Microsoft.Reporting.WinForms.ReportViewer.
Type A originates from 'Microsoft.ReportViewer.WinForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'LoadNeither' at location 'C:\Users\ComputerName\AppData\Local\Microsoft\VisualStudio\16.0_81430e9d\ProjectAssemblies\tmy4po5j01\Microsoft.ReportViewer.WinForms.dll'.
Type B originates from 'Microsoft.ReportViewer.WinForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'LoadFrom' at location 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\SSAS\Microsoft.ReportViewer.WinForms.dll'.

at Microsoft.Reporting.WinForms.ReportViewerDesigner.get_ActionLists()
at System.ComponentModel.Design.ComponentDesigner.CDDesignerCommandSet.GetCommands(String name)
at System.ComponentModel.Design.DesignerCommandSet.get_ActionLists()
at System.Com...'

2
Could you please provide more information about what have you done? - Masoud Keshavarz

2 Answers

0
votes

I had the same problem, to solve it i had to install the same version of Reporting Services and SQL Server Types packages. Look at the image for versions details.

Image

-1
votes

I have the same issue problem happened after updating the nuget package. If i build the solution the reports still work. i cant edit them in visual studio then i get this error in the disigner,