I am deploying a desktop application to my clients that uses the Crystal Reports API to display and print forms. I am building my installer using InstallShield 2012. I have also included the .NET 4.0 Framework along with all of the Crystal assemblies. I have 2 (kinda related) concerns:
1) Whenever I tried to run the application on the client machine, I get the following error:
The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument'
threw an exception.
I have no idea what I am forgetting here. The CrystalDecisions.CrystalReports.Engine
dll is being registered in the GAC correctly, as are about 10 other Crystal assemblies.
2) I have asked this question on the SAP forums, and I was told I needed to include the .NET 2.0 Framework along with the .NET 4.0 Framework. I tried including the .NET 2.0 redistributable in my installer package, but the installer does not install it. Does the installer see that I have 4.0 installed, so it skips the 2.0 installation?
This question is related to
c#
.net
deployment
installshield
crystal-reports-2010
What did the trick for me was to change the target machine from “ANY CPU” to “x64” or maybe in your case “x86” depending in your target machine’s architecture. I would try this first before moving into a more complex solution which indicates a more complex problem.
As "M.A. Hanin" said above, it can caused by an InnerException
like this:
"Unrecognized configuration section userSettings. (C:\Users\Pourakbar.h\AppData\Local\Accounting\Accounting.vshost.exe_Url_a4h1gnabohiu4wgiejk0d21rc2kbwr4g\1.0.0.0\user.config line 3)"
and I deleted the folder: C:\Users\Pourakbar.h\AppData\Local\Accounting\Accounting.vshost.exe_Url_a4h1gnabohiu4wgiejk0d21rc2kbwr4g
from my computer and that worked for me!
I had the same problem and I solved it installing both crystal Report Runtime 32 and 64 bit both version
Download cr redist 2005 or 2008(which is your tool) or copy from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports
Download c++ redist 2005 or 2008(which is your tool)
Install both and restart your system
Problem solved.
I was not getting the error on 32-bit machines but was on 64-bit so I changed the target platform from x86 to Any CPU and it resolved the issue.
Project Properties -> Compile -> Target CPU -> Any CPU And uncheck Prefer 32 bit
Done
For one full day i searched online and i found a solution on my own. The same scenario, the application works fine in developer machine but when deployed it is throwing the exception "crystaldecisions.crystalreports.engine.reportdocument threw an exception" Details: sys.io.filenotfoundexcep crystaldecisions.reportappserver.commlayer version 13.0.2000 is missing
My IDE: MS VS 2010 Ultimate, CR V13.0.10
Solution:
i set x86 for my application, then i set x64 for my setup application
Prerequisite: i Placed the supporting CR runtime file CRRuntime_32bit_13_0_10.msi, CRRuntime_64bit_13_0_10.msi in the following directory C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\Crystal Reports for .NET Framework 4.0
Include merge module file to the setup project. Here is version is not serious thing because i use 13.0.10 soft, 13.0.16 merge module file File i included: CRRuntime_13_0_16.msm This file is found one among the set msm files.
While installing this Merge module will add the necessary dll in the following dir C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet
dll file version will not cause any issues.
In your developer machine you confirm it same.
I need reputation points, if this answer is useful kindly mark it useful(+1)
The type initializer for CrystalDecisions.CrystalReports.Engine.ReportDocument
threw an exception.
I changed the target platform from x86
to Any CPU
and it resolved the issue.
I faced the same issue. The target platform was Any CPU in my case. But the checkbox "Prefer-32Bit" was checked.. Unchecking the same resolved the issue.
Check the properties of your projectm the platform target. Install the corresponding version of Crystal Reports:
To x86 > CRforVS_redist_install_32bit
To x64 > CRforVS_redist_install_64bit
I had similar message and after several searches online and doing all suggestions, nothing helped. Finally I found the solution. In my IIS server, under the application pool advance option, there is an option for "Enable 32-Bit Applications" - that was changed from false to true and after restarting IIS server, My program started generating pdf files.
I got a problem The type Initializer.. my config file resolved it..
i forgot to have a connection element like this
"connectionStrings"
"/connectionStrings"
maybe it depends on what you did in a code. my error is i cant open a class because of this connection element.
The inner exception of bug says Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
Changing the AppPool setting False for Enable 32-bit Application solved the issue
I had a similar error recently with the log4net error:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
This was on a 64bit machine but I'd only installed the 32bit
runtime.
Making sure the build was targeting only x86
worked for me.
This is because of lack of Capability .... If you see the Inner Exception you will see this message
"Access is denied.
Access to speech functionality requires ID_CAP_SPEECH_RECOGNITION to be defined in the manifest."
So to get rid of this exception. turn on the capability for Speech Recognition from the Manifest file.
I had the same problem, and It solved my Problem. :)
Here is what worked for me:
If you are installing on a 64-bit machine, make sure the application properties under the Build tab have "Any CPU" as the platform target, and unselect the check box for "Prefer 32-bit" if you have the option. Crystal is very touchy about 32/64 bit assemblies, and makes some pretty counterintuitive assumptions which are very difficult to troubleshoot.
Source: Stackoverflow.com