cancel
Showing results for 
Search instead for 
Did you mean: 

log4net.dll and other errors like CrystalDecisions.ReportAppServer.*

former_member208657
Active Contributor
0 Kudos

There have been a number of posts on the forums lately about problems with log4net.dll and other files like CrystalDecisions.ReportAppServer.CommonObjectModel. These have all been tied together with ClickOnce deployments, or adding the Crystal Reports for Visual Studio 2010 runtime as a prerequisite.

I recently found some settings in Visual Studio that have an impact on this.

- Go into your project Properties.

- Then go to the Publish tab.

- Click the Application Files button.

- Select to Exclude any file with CrystalDecisions or BusinessObjects in the name. Plus exclude log4net.dll.

- Click OK

- Rebuild your application, then republish it to your site or file share to be installed by your clients.

See the attached screenshot for an example.

Let us know if this helps you out.

Happy holidays all!

Accepted Solutions (1)

Accepted Solutions (1)

former_member208657
Active Contributor
0 Kudos

While working on another case I've found some other causes of errors like log4net and Could not load file or assembly YourLibrary or one of its dependencies. An attempt was made to load a program with an incorrect format

These issues occur when you are building your project that contains class libraries (with Crystal Reports references 13.0.99) you've included from other sources. When your project is set to target the x86 platform there are no issues. Everything goes wrong when you are targetting x64, or in the case of a web site project, you get the above Could not load file or assembly 'YourLibrary' ...

What I found is that this is linked to how Visual Studio builds your solution. Because Visual Studio is a 32 bit app it uses the 32 bit version of MSBuild. This is the cause of the errors. If you are targetting the x64, or have a web site that is consuming a 64 bit library file, you need to use the 64 bit version of MSBuild. This needs to be done at a command line level though, and it takes you out of using the Visual Studio IDE.

There is a great blog from on the MSDN site that goes into great detail on this issue,

[Building on Cross targeting scenarios and 64-bit MSBuild|http://blogs.msdn.com/b/visualstudio/archive/2010/05/07/building-on-cross-targeting-scenarios-and-64-bit-msbuild.aspx]

I was able to find my 64 bit MSBuild in this directory C:\Windows\Microsoft.NET\Framework64\v4.0.30319

To compile my application I used a simple command like this

MSBuild.exe u201CC:\Path to my solution\mySolution.slnu201D

Try this out if you are having problems compiling your solutions to target 64 bit, or are using 64 bit libraries.

former_member208657
Active Contributor
0 Kudos

Here is one other Microsoft kbase I found while researching this issue.

[Issues related to Building Visual Studio 2008 projects (.NET 3.5 or lower) using Visual Studio 2010 or Team Build 2010|http://support.microsoft.com/kb/2490734]

Answers (3)

Answers (3)

Former Member
0 Kudos

Does the Crystal lib require a certain version of log4net? I noticed that after I installed the free Crystal for VS 2010 that I've got a log4net.dll in there with the same public key token as your Crystal DLLs (which seems odd--did you guys do your own log4net build?) and that clients can't run my app, even though they have version 1.2.10 of log4net, unless they have log4net with your public key token.

We build with this:

<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">

<HintPath>lib\log4net.dll</HintPath>

</Reference>

The user gets this error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'CrystalDecisions.ReportSource.ReportSourceFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'

at CrystalDecisions.Shared.SharedUtils..cctor()

former_member183750
Active Contributor
0 Kudos

See the KBase [1550854 - "Could not load file or assembly 'log4net' or one of its dependencies" Error when building Visual Studio 2010 solution utilizing the Crystal Reports .NET Runtime|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533353330333833353334%7D.do].

If that does not help, please create a new thread.

- Ludek

Former Member
0 Kudos

Hi

Can i know what is this file (log4net.dll) used for ???

Thanks

former_member183750
Active Contributor
0 Kudos

http://www.codeproject.com/Messages/3872202/Log4Net-dll-what-is.aspx

If you need more info, Google log4net.dll or contact Microsoft...

- Ludek

Former Member
0 Kudos

That was a thread created by me.

I got the answer. Thanks a lot.

Bye

Former Member
0 Kudos

the big problem is that all mighty SAP decided to create it's own strong name to the log4net.dll .

Crystal loads the log4net into the GAC, and if you have a project that has it's own log4net, that you downloaded from apache's website you will face errors .

why ?

because in your project you have reference to

Public key token is 1b44e1d426115821

which is the original log4net dll,

but during compilcation, VS2010 will take the log4net dll from the GAC , as it has the same version number !

but in the gac, the stong name is

Public key token is 692fbea5521e1304

and not you have a mismatch !!!!!

if i remove crystal's version from the GAC things work nicely. but someone , somehow always installs it back into the GAC. and i even dont know from where that file comes from ! i've searched my entire computer !

0 Kudos

Got the same error, 'cannot find log4net.dll', with a winforms application, running on a win7/64bit desktop.

After creating an MSI with the CRRuntime_13_0.msm the error shows up.

So I installed the CRRuntime_64bit_13_0.msi package too, and it all worked.

Shouldn't the mergemodule package contain all the files needed on a client machine (not being a development machine)?

When downloading the CRRuntime_64bit_13_0.msi, from http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567, you download a CRforVS_redist_install_64bit_13_0.zip which suggest its for an environment where VS2010 is installed too.

Where can I find a single mergemodule package CRforVS_redist_install_64bit_13_0.zip containg all the required files?

regards,

Marcel

former_member208657
Active Contributor
0 Kudos

The merge modules we have available are 32 bit only. There are no plans to make 64 bit merge modules available for Crystal Reports for Visual Studio 2010. You'll need to use the MSI package to deploy the 64 bit runtime.

0 Kudos

Sorry , made a little copy/paste error,

the last line should be from my previous message should be:

Where can I find a single mergemodule package CRRuntime_13_0.msm containg all the required files?

I only need a single client runtime package for 64bit, so not for a development environment.

regards,

former_member208657
Active Contributor
0 Kudos

Use the 64 redist installer on the reference page below. No merge modules for 64 bit though, sorry. If you want 64 bit merge modules you can put the idea forward on [Idea Place|http://www.sdn.sap.com/irj/scn/idea-place] then have people vote it up.

[original link is broken]

Former Member
0 Kudos

Hi Guys

I'm also had the same issue, please try to help me.

I'm developing a web application using Visual Studio.NET 2010 (.net 4), my application uses Crystal Reports for VS 2010.

Everything is fine on my development machine "as usual", the drama starts when i deploy my site to my web server "asp.net discount", i'm geeing the error below.

<!--

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

-->

<!--

Stack Trace:

[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]

CrystalDecisions.Web.CrystalReportViewer..cctor() +0

[TypeInitializationException: The type initializer for 'CrystalDecisions.Web.CrystalReportViewer' threw an exception.]

CrystalDecisions.Web.CrystalReportViewer..ctor() +0

ASP.test_moredetails_aspx.__BuildControlCrystalReportViewer1() in E:\web\greenarrowe\htdocs\test\moredetails.aspx:15

ASP.test_moredetails_aspx.__BuildControlform1() in E:\web\greenarrowe\htdocs\test\moredetails.aspx:12

ASP.test_moredetails_aspx.__BuildControlTree(test_moredetails_aspx __ctrl) in E:\web\greenarrowe\htdocs\test\moredetails.aspx:1

ASP.test_moredetails_aspx.FrameworkInitialize() in E:\web\greenarrowe\htdocs\test\moredetails.aspx.vb:912307

System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +54

System.Web.UI.Page.ProcessRequest() +78

System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21

System.Web.UI.Page.ProcessRequest(HttpContext context) +49

ASP.test_moredetails_aspx.ProcessRequest(HttpContext context) +37

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

-->

I tried to fix it, by deploying the crystal reports dll files, i also deployed the log4net.dll file within my Bin folder, but nothing changed.

Any ideas

Thanks in advance.

Abdullah EL-Gendy

Edited by: aelgendy on Jan 22, 2011 12:10 AM

former_member208657
Active Contributor
0 Kudos

The error usually occurs at runtime because the web site/application is running in a different platform than the Crystal SDK you deployed.

Eg.

Either your application pool is set to 32 bit and you deployed the 64 bit version of Crystal Reports for VS 2010.

or, your application pool is set to 64 bit and you deployed the 32 bit version of Crystal Reports for VS 2010.

Also, is this a web site or a web application. We need to know if your site has a bin directory and the logic is compiled into a dll file. If so you need to be careful because that class library file can cause issues depending on the platform it targets.