Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Container with support for Crystal Reports

I am trying create a Docker image to host my asp.net MVC app that has a dependency on Crystal Reports.

My dockerfile looks like this

FROM microsoft/iis

COPY ./bin/Release/Publish/ c:\\inetpub\\wwwroot

RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]  
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]

#install Crystal reports runtime
COPY Resources/Files/CRRuntime_64bit_13_0_21.msi . 
RUN powershell.exe -Command Start-Process CRRuntime_64bit_13_0_21.msi -ArgumentList '/quiet' -Wait

The installing of the CRRuntime_64bit_13_0_21.msi fails. I logged onto my container and ran the msi install from powershell and produced a log. Its very long but here are 2 things that stand out:

  1. Error 1904. Module C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64\pageobjectmodel.dll failed to register. HRESULT -2147024770. Contact your support personnel. Action ended 17:20:50: InstallFinalize. Return value 3.

  2. Action ended 17:23:56: INSTALL. Return value 3. MSI (s) (3C:54) [17:23:56:467]: Product: SAP Crystal Reports runtime engine for .NET Framework (64-bit) -- Installation operation failed. MSI (s) (3C:54) [17:23:56:467]: Windows Installer installed the product. Product Name: SAP Crystal Reports runtime engine for .NET Framework (64-bit). Product Version: 13.0.21.2533. Product Language: 1033. Manufacturer: SAP. Installation success or error status: 1603.

The first error does not seem to halt the install.

Any suggestions for troubleshooting this are welcome as are alternative ways of creating the image.

Also, just to confirm. The website loads and runs fine. I just can't use any of the features that require the Crystal Reports dependency.

like image 716
robsta Avatar asked Apr 11 '19 17:04

robsta


People also ask

Can we use Docker with ASP NET?

ASP.NET Core Docker images For this tutorial, you download an ASP.NET Core sample app and run it in Docker containers. The sample works with both Linux and Windows containers. The sample uses this image for building the app.

Can Visual Studio run in a container?

If you already have a project of a supported type, Visual Studio can create a Dockerfile and configure your project to run in a container.

Can you Containerize .NET framework?

NET Framework application must run on Windows, period. If you want to containerize existing . NET Framework applications and you can't or don't want to invest in a migration to . NET Core or later("If it works properly, don't migrate it"), the only choice you have for containers is to use Windows Containers.


2 Answers

Using the full Windows 2019 container mcr.microsoft.com\windows:1809 as a base, the installer works, which hints that it's just down to missing OS components.

I don't get the 'Error 1904' logged but maybe I'm on a different host OS.

The installer log shows that a custom action SetASPDotNetDllPath is failing.

If you:

  • Open the installer MSI (e.g. in Orca)
  • Locate and extract the action binary, save as dll
  • Inspect its imports (e.g. with dumpbin)

This shows a dependency on oledlg.dll. This is its only dependency which isn't available in Server Core.

Its not great, but you can copy this version from the full windows container to fix it:

FROM mcr.microsoft.com/windows:1809 as dll_source
FROM microsoft/iis

#hack in oledlg dll!!
COPY --from=dll_source /windows/system32/oledlg.dll /windows/system32/oledlg.dll 
COPY --from=dll_source /windows/syswow64/oledlg.dll /windows/syswow64/oledlg.dll 

RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]  
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]

WORKDIR c:/temp
COPY CRRuntime_64bit_13_0_21.msi . 
RUN powershell.exe -Command Start-Process c:\temp\CRRuntime_64bit_13_0_21.msi -ArgumentList '/l*v c:\temp\install.log' -Wait
like image 188
Peter Wishart Avatar answered Oct 14 '22 01:10

Peter Wishart


I'm going to add an additional answer while Peters answer worked perfectly for installing Crystal Reports, I had an additional issue with missing Fonts when exporting to PDF from Crystal Report.

This is what I've ended up with. The key is the change in the image tag name to be an older version.

#windowsservercore-1803 required as it has the fonts we need in the report in order to export to PDF
FROM microsoft/iis:windowsservercore-1803

#install features we need
RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]

#hack in oledlg dll so that Crystal Runtime will install
COPY Resources/Files/64/oledlg.dll /windows/syswow64/oledlg.dll
COPY Resources/Files/32/oledlg.dll /windows/system32/oledlg.dll

#copy in Crystal MSI and install. Note it's 64bit version
WORKDIR c:/temp
COPY Resources/Files/CRRuntime_64bit_13_0_21.msi .
RUN powershell.exe -Command Start-Process c:\temp\CRRuntime_64bit_13_0_21.msi -ArgumentList '/quiet /l*v c:\temp\install64.log' -Wait

#Add website files
COPY ./bin/Release/Publish/ /inetpub/wwwroot

For some reason Microsoft have dropped lots of fonts from version 1803 to 1809. I can only assume to reduce the OS image size.

like image 5
robsta Avatar answered Oct 14 '22 00:10

robsta