Skip to Content
0

VS2017 and CR dreport won't open

Apr 10 at 12:01 PM

11

avatar image

I hope this isn't too long.

My computer is running 64-bit Windows 10. I have several projects that I designed for my own use. They were last updated last year using VS2015 and Crystal Reports for Visual Studio. All of them ran without any problems. I’m in the process of refreshing my computer and reinstall the software. In doing so I upgrade to VS2017. I then installed (as Admin) CRforVS_13_0_21 and CRforVS_13_0_22. In version 21 it could not load the 64-bit runtime, but it loaded during the version 22.
This is the code in the Report Viewer:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class frmReportViewer

#Region "Crystal Report Notes"
' 1. See the document in the "\Documents" folder for the steps to create the Grouped report.
' 2. The Crystal report will not run until the following changes are made to "App.Config"
' Delete the following:
' <startup>
' <supportedRuntime version = "v4.0" sku=".NETFramework,Version=v4.5.2" />
' </startup>
' Add the following:
' <startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
#End Region

#Region "Declares"
Private RPT As New ReportDocument
#End Region

#Region "Form Load"
Private Sub frmReportViewer_Load(sender As Object, e As EventArgs) Handles Me.Load
With RPT
.FileName = ReportName
.SetDataSource(ReportData)
If (ReportFormulas <> String.Empty) Then
If (HandleFormulaProcessing() = False) Then
Close()
End If
End If
End With
With crvReport
.ReportSource = RPT
.Refresh()
End With
End Sub
#End Region
It appears to error in the Declare statement.
Error message:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.
Source=CrystalDecisions.CrystalReports.Engine
StackTrace:
at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
at Books.frmReportViewer..ctor() in E:\My Documents\Visual Studio 2017\Projects\Books\Forms\ReportForm\frmReportViewer.vb:line 18
at Books.frmMain.HandleEbookReport(String strReportName) in E:\My Documents\Visual Studio 2017\Projects\Books\Forms\MainForm\frmMain.vb:line 97
at Books.frmMain.HandleMenus(Object Sender, EventArgs EA) in E:\My Documents\Visual Studio 2017\Projects\Books\Forms\MainForm\frmMain.vb:line 241
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Books.My.MyApplication.Main(String[] Args) in :line 81

Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers