I am developing a Windows desktop application targeting .NET Framework 4.8 using Visual Studio 2022.
When attempting to display a Crystal Report, I encounter the following runtime error:
Could not load file or assembly 'CrystalDecisions.Shared, Version=13.0.4000.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
This appears to be an assembly version mismatch, but I am unsure how to correctly resolve it.
Environment
Issue Details
My project references multiple Crystal Reports packages with different versions (for example, 13.0.4003 and 13.0.200). I suspect this version inconsistency may be causing the problem, but I am not certain which assemblies should be aligned or whether I need to install a specific Crystal Reports runtime.
Below is my packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CrystalDecisions.CrystalReports.Engine" version="1.0.0" targetFramework="net48" />
<package id="CrystalDecisions.ReportSource" version="1.0.0" targetFramework="net48" />
<package id="CrystalDecisions.Shared" version="1.0.0" targetFramework="net48" />
<package id="CrystalDecisions.Windows.Forms" version="1.0.0" targetFramework="net48" />
<package id="CrystalReports.Engine" version="13.0.4003" targetFramework="net48" />
<package id="CrystalReports.Shared" version="13.0.200" targetFramework="net48" />
<package id="CrystalReports.Windows.Forms" version="13.0.4003" targetFramework="net48" />
</packages>
Questions
How can I fix this assembly mismatch error?
Which Crystal Reports runtime version should be installed for a .NET Framework 4.8 application?
Should all Crystal Reports assemblies use the exact same version?
Is it recommended to use NuGet packages for Crystal Reports, or should I install the SAP Crystal Reports developer version instead?