Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine' / Windows 2012 server

we have an application written in .NET 4.0 which uses this SAP Crystal Reports. While the same build (x86) is working perfectly OK in Windows 2003/2008 (both x86/x64) with .NET 4.0 framework installed (x86) and CrystalReports runtimes installed (donwladed from SAP pages http://scn.sap.com/docs/DOC-7824) using the 13.0.1.x (32bit_13_0_1.msi).

When the same stuff is installed in MS 2012 server (x64), there is already .NET framework 4.5 pre-installed, thus I was not able to install .NET 4.0, however it looks like it's backwards compatible, because the application is working properly, with exception of the Crystal Reports part, where the application throws an exception.

Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version 10.5.3700.0, culture=neutral, PublicKeyToken=blahblah' or one of its dependencies. The system cannot find the file specified.

Of course the runtimes are installed, but for some reason our application can't recognize those DLLs. Personally I don't think it's a build issue as it works properly with same configuration in 2003/2008 server.

We have there only release version installed, so no debugging options are available, nor VS is installed.

Basically we're just performing some tests if the application works properly in 2012 server, but this issue seems impossible to solve. I've spent hours on Google to no avail. So any idea what to check is highly appreciated :)

Thanks Tomas


Edit


Solution: to install older 2008 runtimes.
Root cause: On our build machine we have both runtimes still installed (we need to support older versions as well). In proj files the CR assemblies are not referenced version specific, just by the name. So during the build process the first lowest matching assembly from GAC was used and hence the need to have the CR 2008 installed as well. Solution is to reference the 3rd party assemblies in project files also by version to force the usage of newer ones.

like image 552
TomKyblik Avatar asked May 15 '13 12:05

TomKyblik


2 Answers

We ran into the same issue, however in our project the version was specified. Also our project was not strong named. Strong naming the assemblies would make this a non issue.

.csproj before

<Reference Include="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL">
     <SpecificVersion>False</SpecificVersion>     <HintPath>..\..\..\..\..\Workspace\SharedLibraries\trunk\Lib\CrystalDecisions.ReportSource.dll</HintPath>
   </Reference>

Notice the SpecificVersion is set to false. Switching this to true might of solved the issue, we did not try that.

The hint path was either not found or was the older version. If it was not found then it would grab the first Crystal dll found in the GAC which is the 10.5 version.

.csproj after

<Reference Include="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL" />

This forces the build against the correct version.

like image 187
Chuck Conway Avatar answered Sep 30 '22 12:09

Chuck Conway


Another solution would have been to upgrade to Crystal Reports for Visual Studio, which is compatible with VS2010+. If you want to be able to edit the reports in recent Visual Studios, this is the way to go. Your solution of installing the older runtime solves the problem without changing the solution, whereas the newer crystal install requires upgrading all the reports in the solution.

like image 32
kristianp Avatar answered Sep 30 '22 11:09

kristianp