1639004 - Load Assembly error when using ADO .NET datasets and Crystal Reports WPF viewer

SAP Knowledge Base Article - Public

1639004 - Load Assembly error when using ADO .NET datasets and Crystal Reports WPF viewer

Symptom

  • Using the Crystal Reports for Visual Studio 2010 WPF viewer
  • Connecting to an ADO .NET Dataset results in the error:

Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

Environment

  • Visual Studio 2010
  • Crystal Reports for Visual Studio 2010

Reproducing the Issue

  • Create a WPF application in VS2010
  • Add the Crystal Reports WPF viewer
  • In the application code load a report
  • Point the report at an ADO .NET dataset:

Cause

  • The database driver used to connect to ADO .NET Datasets (crdb_adoplus.dll)  is compiled for framework 2.0 only

Resolution

  • Create an interface with the following code:
Imports System.Runtime.InteropServices
Imports System.Runtime.CompilerServices
<ComImport()> _
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
<Guid("BD39D1D2-BA2F-486A-89B0-B4B0CB466891")> _
Interface ICLRRuntimeInfo
Sub xGetVersionString()
Sub xGetRuntimeDirectory()
Sub xIsLoaded()
Sub xIsLoadable()
Sub xLoadErrorString()
Sub xLoadLibrary()
Sub xGetProcAddress()
Sub xGetInterface()
Sub xSetDefaultStartupFlags()
Sub xGetDefaultStartupFlags()
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Sub BindAsLegacyV2Runtime()
End Interface
  • Use the statement in page that is making the call:
Dim rtInfo As ICLRRuntimeInfo = DirectCast(RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, GetType(ICLRRuntimeInfo).GUID), ICLRRuntimeInfo)
rtInfo.BindAsLegacyV2Runtime()

 

 

Keywords

CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 framework frmwrk , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio