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

3

6

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.

Vast answered 15/5, 2013 at 12:44 Comment(1)
Ok, solved it. By using "gacutil /lr" I realized that CR used for build were for VS 2008. Installing older runtimes solved this issue.Vast
S
5

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.

Schober answered 4/12, 2013 at 19:29 Comment(0)
A
1

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.

Alan answered 5/1, 2015 at 5:57 Comment(0)
B
1

I solved that assembly error by:

  • First only unistall package using NuGet package
  • Second is to install again using NuGet package
  • And the last is to publish and upload to the VPS and it will work.
Bodi answered 3/10, 2016 at 7:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.