locked
How do I resolve the "Could not load file or assembly CrystalDecisions.ReportAppServer.CommLayer" error? RRS feed

  • Question

  • User-900017823 posted

    I'm working on an old WebForms app written many years ago by someone whose long since left. This is a Website application, not a Web Application. I think the original developer was working with either ASP.NET 1.x or maybe 2.0. So, I'm guessing all Visual Studio gave him was Website project.

    Anyway, I'm working on my Windows 10 Enterprise laptop with VS 2017 Enterprise. I've been able to successfully replace several .DLL's that he carried around, with NuGet packages. All of these were CrystalDecisions types of NuGet packages. I can easily compile it and run it, until I try to generate a report (they're all Crystal reports). When I try to run one of the reports I get the following 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 CrystalDecisions.CrystalReports.Engine.ReportClass..ctor()
    at timetrackreports.rpt_tt0001..ctor() in D:\WebSites\FPTimeTracker\timetrackreports\rpt_tt0001.vb:line 25
    at timetrackreports.rb0001.MakeReport(ReportParameters ps, String ConnectionString, String EnvironmentString) in D:\WebSites\FPTimeTracker\timetrackreports\rb0001.vb:line 10
    at ReportPrinter.Page_Load(Object sender, EventArgs e) in D:\WebSites\FPTimeTracker\TimeTrackSite\ReportPrinter.aspx.vb:line 29

    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.

    I went to the NuGet gallery and found a CrystalDecisions.ReportAppServer package there, which I had hoped would resolve my issue, so I installed that package. It didn't resolve my problem. So, what should I do to get this working on my development laptop?

    Thursday, February 21, 2019 9:07 PM

Answers

  • User475983607 posted

    DoctorWho

    I've run RegEdit on the servers. The CrystalDecision.ReportAppServer.CommLayer is in the registry. I've got to conclude that it's in the GAC.

    I think you misunderstand how the GAC works.  Just put the file in the bin folder once you find it.  The bin overrides the GAC.  Secondly, if you keep pressing F5 in regedit you will eventually find the file path to that specific DLL.

    https://docs.microsoft.com/en-us/dotnet/framework/app-domains/gac

    Early Version GAC location

    %windir%\Microsoft.NET\assembly

    4+ location

    %windir%\assembly

    DoctorWho

    I'm going to hunt around to find where we've got Crystal, install it on my laptop, which I presume will put that .DLL into my laptop's GAC.

    It might work it might not.  I assume your laptop does not have the same DLL version since this is an older application.  It's best to find the known working DLL and copy it to your bin folder.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 21, 2019 10:48 PM

All replies

  • User475983607 posted

    IIRC, Way back in .NET 1.1 and 2.0 you had to install Crystal Reports. 

    Anyway, you might try to find the DLL on the server, copy the DLL to your laptop, then register the DLL on your laptop.

    Also try Googling the Error.

    https://www.google.com/search?rlz=1C1GGRV_enUS812US812&biw=1366&bih=625&ei=OBRvXK6RDui3ggfT7ICQAw&q=%27CrystalDecisions.ReportAppServer.CommLayer%2C+Version%3D13.0.2000.0&oq=%27CrystalDecisions.ReportAppServer.CommLayer%2C+Version%3D13.0.2000.0&gs_l=psy-ab.3...523243.523243..523977...0.0..0.89.89.1......0....2j1..gws-wiz.......0i71.yEabU6FL59k

    Thursday, February 21, 2019 9:27 PM
  • User-900017823 posted

    I did try searching, but all of the posts the search results gave me, were for running the website on the server. Not for developing on one's dev box.

    I'll try looking for what that .DLL on other systems.

    Thursday, February 21, 2019 9:30 PM
  • User475983607 posted

    I did try searching, but all of the posts the search results gave me, were for running the website on the server. Not for developing on one's dev box.

    Your dev box is a server too.

    Thursday, February 21, 2019 9:44 PM
  • User-900017823 posted

    DoctorWho

    I did try searching, but all of the posts the search results gave me, were for running the website on the server. Not for developing on one's dev box.

    Your dev box is a server too.

    Granted. I was just thinking that the posts I found were of the variety, "It works fine on my dev box; but doesn't once I deploy it to a server". So, I was saying that it doesn't even work on my dev laptop.

    Thursday, February 21, 2019 9:47 PM
  • User475983607 posted

    DoctorWho

    Granted. I was just thinking that the posts I found were of the variety, "It works fine on my dev box; but doesn't once I deploy it to a server". So, I was saying that it doesn't even work on my dev laptop.

    But it does work on the web server, correct?  Hopefully you can copy the DLL to you dev box and it works.  I think you had to install crystal reports but can't remember.

    Thursday, February 21, 2019 9:55 PM
  • User-900017823 posted

    DoctorWho

    Granted. I was just thinking that the posts I found were of the variety, "It works fine on my dev box; but doesn't once I deploy it to a server". So, I was saying that it doesn't even work on my dev laptop.

    But it does work on the web server, correct?

    Yes it does, but I've made significant changes to the solution, so I thought I likely to be too out of sync. Maybe I'm wrong about that. I'll check the server.

    Thursday, February 21, 2019 9:58 PM
  • User475983607 posted

    Yes it does, but I've made significant changes to the solution, so I thought I likely to be too out of sync. Maybe I'm wrong about that. I'll check the server.

    But your code changes do not affect the crystal reports DLL.

    Thursday, February 21, 2019 9:59 PM
  • User-900017823 posted

    I've just checked the production and test web servers where this app is installed. I cannot find any CrystalDecisions related .DLL's on either. So, I'm guessing its installed in the GAC. Visual Studio is not installed on those servers, so the only way I know of to find out what's in the GAC is to use the GACUTIL utility. However, I cannot install VS on the servers. Is there another way to find out what's in the GAC?

    Thursday, February 21, 2019 10:08 PM
  • User475983607 posted

    DoctorWho

    I've just checked the production and test web servers where this app is installed. I cannot find any CrystalDecisions related .DLL's on either. So, I'm guessing its installed in the GAC. 

    Where did you look?  Keep in mind that the assemblies loaded in the GAC are also on disk otherwise restarting the computer would be an issue.

    Like I said, I think crystal reports was an add-in and was installed.  It's probably in the System32 folder.  If you have trouble finding the DLL, you can always open regedit and do a find for the DLL One of the registry nodes  should have the file path.

    Thursday, February 21, 2019 10:14 PM
  • User-900017823 posted

    I've run RegEdit on the servers. The CrystalDecision.ReportAppServer.CommLayer is in the registry. I've got to conclude that it's in the GAC. I'm going to hunt around to find where we've got Crystal, install it on my laptop, which I presume will put that .DLL into my laptop's GAC.

    Thursday, February 21, 2019 10:26 PM
  • User475983607 posted

    DoctorWho

    I've run RegEdit on the servers. The CrystalDecision.ReportAppServer.CommLayer is in the registry. I've got to conclude that it's in the GAC.

    I think you misunderstand how the GAC works.  Just put the file in the bin folder once you find it.  The bin overrides the GAC.  Secondly, if you keep pressing F5 in regedit you will eventually find the file path to that specific DLL.

    https://docs.microsoft.com/en-us/dotnet/framework/app-domains/gac

    Early Version GAC location

    %windir%\Microsoft.NET\assembly

    4+ location

    %windir%\assembly

    DoctorWho

    I'm going to hunt around to find where we've got Crystal, install it on my laptop, which I presume will put that .DLL into my laptop's GAC.

    It might work it might not.  I assume your laptop does not have the same DLL version since this is an older application.  It's best to find the known working DLL and copy it to your bin folder.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 21, 2019 10:48 PM