Requires log4net version 1.2.10 be installed in GAC - visual-studio-2010

With a windows smart client application, it runs fine on my (development) machine, but when I installed it on a user's machine, I get this error:
Requires log4net version 1.2.10 be installed in GAC
On my development machine, I have 2 log4net files that are GACed: one x86, one 64 bit. The user machine has only the x86 version. So I guess the user needs the 64 bit, yes?
If so, how do I install a 64 bit version of log4net?
Note that this is a different error than this:
Error: Could not load log4net assembly
I've discovered another difference. If I publish in Development/Debug configuration, it works. If I publish in Release config, I get the error.
There seems to be no direct log4net references. It is use in either CrystalReports or NHibernate or both.
In Debug Configuration, the application is running as 32bit, in Release Configuration, the application is running as 64bit. If I could get the Release Configuration to run as 32bit, I think that would solve the problem. Can anyone say how that is done?

You can change the Release configuration to x86 in Visual Studio => Project properties => Compile => Advanced Compile options

Check if you have Copy local=true on the log4net reference. If it is false the log4net has to be installed in the GAC, when it is true it is included in the application bin directory.
If you want to install it in the gac you can use gacutil to install the log4net.dll into the gac. Check if you application runs in 64bit (process explorer), if so, you need to install the 64bit version.

I faced similar issue with my ClickOnce application. I tried to put log4net dll in GAC and publish, but didn't work. It was also not related to 32/64 bit version as well.
The solution worked foe me is
Remove and add log4net references in all the required projects from local folder.
Check log4net reference properties and make sure property "CopyLocal=True" for all references. (In my case one of the referenced project was referring log4net with "CopyLocal=False" and thus looking for DLL in GAC)
(For ClickOnce deploy applications) Remove and add referenced DLLs (which refer log4net) in the main project. This will force all the DLLs to be downloaded to client's machine again.
Hope this helps.

Related

An attempt was made to load a program with an incorrect format for Microsoft.SharePoint.Search.dll on 64-bit system

I'm trying to use Visual Studio to develop and debug a web application that uses the SharePoint 2007 API. I have been doing this fine on a 32-bit server up until now. Today I've moved over to a 64-bit development server and when I try to run the project out of VS, I get:
Could not load file or assembly 'Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I have referenced Microsoft.SharePoint.dll and Microsoft.SharePoint.intl.dll from the GAC on this machine. That automatically copies in Microsoft.SharePoint.Search.dll from somewhere when I run it (even though copy local is false on the references). My project Platform Target is "Any CPU". I get the same error with x86. If I change to x64, I instead get Could not load file or assembly 'MyProjects.dll'...incorrect format.. I've also tried deleting Microsoft.SharePoint.Search.dll from the bin after it starts up but then I get a SharePoint error saying that the site at my URL can't be found, which I believe is also a bitness issue. I'm not quite sure what the issue is but want to be able to run this application out of Visual Studio. How can I get it working?
You need the x64 (or anyCPU) version of the Sharepoint dlls to make it work
Both Microsoft.SharePoint.dll and Microsoft.SharePoint.intl.dll in the server's GAC are built for Any CPU. When I build my web app in Visual Studio, it automatically copies Microsoft.SharePoint.Search.dll into my bin, presumably because it's referenced by Microsoft.SharePoint.dll. SharePoint.Search.dll is not in the GAC. It is copied from the 64-bit 12\ISAPI directory and is built with an "Amd64" target architecture (despite my server having an Intel Xeon CPU). So I believe the problem is VS runs the web app in a 32-bit process which causes the error when it tries to load the 64-bit SharePoint.Search.dll.
My first idea was to explicitly reference the 32-bit SharePoint.Search.dll in my project. That makes the error go away but it is replaced with an error saying the website at [my SharePoint site URL] cannot be found. I believe this is because now I'm trying to access the SharePoint site, which runs in a 64-bit app pool, from a 32-bit process. So what I really need is for Visual Studio to run my web app using a 64-bit hosting process. This looks like an option available for VS 2012, but not 2010. The alternatives I've found for VS 2010 are:
On the project properties Web tab, configure it to run using the Local IIS instance. This will add a virtual directory to the default site, which is running in 64-bit mode by default. This isn't a good solution for me because I want to allow multiple developers to work on the same project on the same server simultaneously. Using the same site would cause conflicts. If there were a way to configure the site name conditionally on the user, this would be ok. I opted to try #2 first.
Replace the VS Development Server with an x64 build of the CassiniDev project. This project has the capability of plugging in to VS in place of the default WebDev.WebServer.EXE. So you just need to download the source code, and build with an x64 target platform. Then you can replace the VS default development server exe, as is documented w/ the CassiniDev project, and it will run an x64 development web server which solves my problem!

Oracle.DataAccess.dll not in Visual Studio 2008 ".NET" reference list

I've got two Windows XP machines with both Visual Studio 2008 and Oracle Client 10.0.2.0.1 installed. One is a development machine and the other one a dedicated build machine. The machines were probably not set up the same way.
On my development machine, I've included Oracle.DataAccess.dll (version 10.2.0.1.100, not the asp.net v 2.x one) in a C# project. Note that the System.Data.OracleClient dll is insufficient (I don't properly remember why, I think it had something to do with bulk insertion/selection).
I was able to select that DLL from the Project->Add Reference dialog in the .NET tab.
Now on the build machine, I cannot build the project as it cannot find the .dll. The .dll is located in the same folder as on the development machine, (<installdir>\10.2.0\client_1\bin\Oracle.DataAccess.dll) in the same version.
The .dll is however not displayed in the .NET tab.
I tried (re)installing ODAC with ODP.Net for VS 2008 but it didn't change anything. When looking at the registry, I realized that my Development machine had a registry folder
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\AssemblyFolders\ODP.Net]
which points to the bin directory of my oracle installation. This entry does not exist on the build machine. Unfortunately, manually adding the key did not make Visual Studio find it (I've tried rebooting).
My main question is:
What do I have to do so the Build Machine automatically finds the Oracle.DataAccess.dll? (Note: manually adding the .dll each time the solution is changed would work, but that is not an option).
You can maybe help me out already by answering one of the following subquestions:
Which installer sets that registry entry?
Do I maybe have to reinstall the whole Oracle Client in a different configuration? (e.g. ADMIN)
Do I need more than just the Oracle Client, ODAC and .NET installed?
I managed to resolve the issue by completely uninstalling the Oracle Client on the build machine, then doing a fresh installation using the Administrator configuration rather than the Developer configuration.
Note that installing the Administrator configuration on top of the existing oracle installation did not work.

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'

I'm using vs2010 and crystal report version 13.0.2000.0 ,system 64bit crystal report runtime 64bit.
my application is running fine on development machine but when i'm deploying on server
getting this error
Could not load file or assembly 'log4net, Version=1.2.10.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'log4net, Version=1.2.10.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304' or one of its dependencies. The
system cannot find the file specified.
Source of error:
CR:CrystalReportViewer ID="CrystalRportViewrRegistration" runat="server" AutoDataBind="true"
and I have checked GAC assembly I didn't find log4net.dll and even in my system I have search all and tried various things like changing runtime version and uploading lo4net dll from apache but no luck.
To configure IIS to run 32-bit applications you must follow these steps:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
If this option is not available to you, follow these next steps:
Go to %windir%\system32\inetsrv\
Execute the appcmd.exe tool:
If you don't see log4net.dll in %systemdrive%\windows\assembly\ on the machine you are attempting to deploy it on, it is likely you haven't successfully installed the redistributable for Crystal Reports for .Net Framework 4.0
Install (or reinstall) the latest service pack from http://scn.sap.com/docs/DOC-7824 (SAP Crystal Reports, developer version for Microsoft Visual Studio Updates & Runtime Downloads)
That runtime distribution should add log4net to the GAC along with a bunch of CrystalDecisions dll's
Ensure version for correct platform (32-bit or 64-bit) is installed. I faced same issue when installed 32-bit run-time on 64-bit machine. Installing correct one, i.e. 64-bit, resolved the issue.
I faced same issue (VS 2015), but my application is running under 32-bit application pool. So even though machine is 64-bit. I installed 32-bit installation and it works.
So in general dll has to be placed in two places:
GAC ( can have 32 and 64 versions of dll's)
your project bin
folder
Thus, you just need add reference to log4net.dll.
(In your case 32-bit with PublicKeyToken=692fbea5521e1304)
You can achive that by
downloading log4net.dll separately and add reference to it
dowloading SAP crystal report SDK (32 bit)
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
For this specific error, I installed version 20 of Crystal Report and it solved my problem:
https://www.tektutorialshub.com/crystal-reports/crystal-reports-download-for-visual-studio/#Service-Pack-16
You can also download the file alone using the following link
https://www.nuget.org/api/v2/package/log4net/1.2.10
rename the file to .zip and extract it.
I tried all of that things and it doesn't worked for me.
I Just installed SAPCrystalReport in my computer and it's working now.
To configure IIS to run 32-bit applications you must follow these steps:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
This solution worked for me, thanks.
If you are building a windows app try to build as x64 instead of Any CPU. It should work fine.
I was able to resolve this issue using below steps:
Uninstall Crystal reports using 'Add or Remove Programs' on Windows.
Closed all running apps and used this link (https://www.tektutorialshub.com/crystal-reports/how-to-download-and-install-crystal-report-runtime/#hownbspto-download) to download SP 29 DEVELOPER EDITION DOWNLOAD (I was using .net framework 4.7.2, see below Crystal report version recommendation for other versions).
❗ Please note: To integrate “SAP Crystal Reports, developer version for Microsoft Visual Studio” you must run the Install Executable by right clicking and selecting "Run as Administrator". Installing the MSI will not fully integrate Crystal Reports into VS. MSI files by definition are for runtime distribution only. Do not run the MSI's on your Development PC, where VS is installed, not required.
References - https://blogs.sap.com/2020/10/30/upgrading-a-visual-studio-2008-2019-.net-project-with-the-latest-cr-.net-sdk-packages/
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
I would say, if you are using 64-bit version of Crystal Reports, just install 32 bit.
That solved my problem.
In my case I migrated crystal report in development computer to last version then migrated the cloud server to same version of crystal report
but after published the site I received this error :
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
the solution I commented the line in web.config
<!--<add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />-->
then publish the site again this solved my issue
Error (While using Visual Studio 2015 in win 10 64 bit machine):
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Solution:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
The above solution is solved my problem.
Thanks.

C++/CLI Missing MSVCR90.DLL

I have a c++/cli dll that I load at runtime and which works great in debug mode. If I try and load the dll in release mode it fails to load stating that one or more dependencies are missing. If I run depends against it I am missing MSVCR90.DLL from MSVCM90.DLL. If I check the debug version of the dll it also has the missing dependency, but against the debug (D) version.
I have made sure debug/release embed the manifest file. I read something about there being issues with the app loading the dll being build as Any CPU and the dll being built as x86, but I don't see how to set them both to x86.
I am using VS2010.
Anyway, I've been messing around for a while now and have no idea what is wrong. I'm sure someone out there knows what is going on. Let me know if I need to include additional info.
alt text http://www.freeimagehosting.net/uploads/fb31c0e256.png
UPDATE:
This ended up being the resolution to my problem: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/07794679-159b-4363-ae94-a68fe258d827
MSVCR90 is the runtime for Visual Studio 2008. If you are running your application on your development PC, then you should have the debug and release runtimes installed (as part of Visual Studio) but it is possible something has gone awry with your install, or that VS2010 doesn't actually include the older runtimes. If you're trying to run the Release on a different PC, then it just needs the runtime installed.
Either way, you may be able to fix it by installing the Visual Studio 2008 redistributable - but make sure you get the right download for your PC (x86 or x64).
In previous versions of VS, you needed the runtime for the version you were compiling with, so if VS2010 follows this precedent you'd need MSVCR100, not MSVCR90 - which suggests that you may not have recompiled the dll with VS2010 - doing so may be another approach to get it running on your PC (using the redist that is in your VS2010 install) but beware that you will still need other users to install the appropriate (VS2010) redistributable on their PC.
As for "Any CPU" versus "x86", this is a problem only on a 64-bit computer. On those systems a 64-bit application can't link dynamically to 32-bit dlls. If you compile your application as "Any CPU" it will be JIT compiled to be 64-bit on an 64-bit OS, so will crash if it tries to call any 32-bit dlls directly. THe solution is to build the application targeting "x86" as that forces the JIT compiler to generate 32-bit code (even on a 64-bit machine) and thus ensures compatibility with the dll you wish to call. If the DLL is a managed assembly, then you can use Any CPU on both the app an dll as they will both be JITted to the same format.
It happened to me something similar running a website in Vistual Studio 2012, after migrating from Visual Studio 2010. The error message was saying that MSVCR90.DLL was missing. The solution was:
1) Delete the folder _bindeployable located at the project path.
2) Rebuild.
I hope it helps.

application failed to initialize properly (0xc0150002) [duplicate]

This question already has answers here:
The application failed to initialize properly (0xc0150002)
(5 answers)
Closed 5 years ago.
my mfc application created in visual studio 5 running on windows server 2000 sp4, i create a release for it and try running it win xp slp2. it gives me application failed to initialize properly (0xc0150002)
i have tried following things
-Install Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) the one that comes within the release folder as well as one downloadable from website
copied all dll and mainfest from microsoft visual sutdio\vc\redist
I still keep receiving the same messsage. c
what could be wrong?how can i fix it
some things to check:
check the /SUBSYSTEM linker option for you project. It might include OS major/minor version numbers.
ensure that you are using appropriate Windows XP PlatformSDK on DEV machine; check values of WINVER, _WIN32_WINNT
use depends to see whether the problem is in unresolved dependencies
check the version of runtime that your application requires with that on target machine. I usually do this by looking at the app's manifest from one side and into WinSxS folder of the target machine from another (recently there had been an ATL Security update from Microsoft http://msdn.microsoft.com/en-us/visualc/ee309358.aspx; new binaries created by updated Visual Studio will not run on machines that haven't the same updated version of runtime).
It is possible you have applied a security update or compiler update to your VS2005 SP1. That makes it generate a manifest that requests a different MFC/CRT-dll than the one installed with Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) .
Try to use Depends.exe and open your application, then in the menu choose "Profile". Look in the output window below for a more detailed description.
Are you trying to run the debug version? That may give you an error similar to 0xc0150002. Try the release build, or you could compile against the static libraries rather than dynamic libraries. If you get this problem on a release build then the chances are that it's a missing dll (in which case try running Depends.exe) or an incorrect manifest.
If you have a missing dependency on a runtime dll you could try creating a deployment project for it as this will detect the appropriate runtime dlls and build it into an installer for you.

Resources