Could not load file or assembly 'log4net' - log4net

My crystal report page gives an error "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."
Do I have to have ddl for 1.2.10 or 1.2.11 in bin folder? Or what can be wrong?

If you have a x86 development machine and your web server is a 64-bit machine, you may be running into the problem discussed in this thread.
Visual Studio is automatically deploying a 32-bit log4net.dll into the 64-bit web server, even if you don't have it referenced in your project. Just delete the log4net.dll from your bin directory once deployment has finished because it's not actually required by the CR runtime to work.

Related

Why my entity framework dll is not loaded?

I'm deploying an application on a production server (so no visual studio installed locally).
I have a EntityFramework.dll in my bin folder.
But I keep getting a 500 error.
Cannot load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of his dependencies
The nuget page says it has no dependency.
I have .net framework 3.5 and 4.7
Any idea on what to look for ?

DNX (ASP.NET Core RC1) web application - cannot host in IIS

I'm trying to deploy an web application still on ASP.NET RC1 (DNX) to IIS. I went through all the Microsoft documentation, but I'm stuck on an issue. I'm getting this error when the application is starting up:
Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'Web' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
File name: 'Web' ---> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException: Startup.cs(104,39): DNX,Version=v4.5.1 error CS0012: The type 'Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
What does this mean? I am able to deploy to IIS on my local machine that I did the development on without any issues. However, just the server with IIS does not work.
How do I go about solving this error? The server is on Windows Server 2008 R2, and my local machine is Windows 7, if that helps.
I was able to resolve this problem using a workaround. It looks like it is an issue with Visual Studio 2015's Publish command. It looks like it does not have an option to publish into Nuget packages. This means the publish command outputs the source files. Hence the files still need to be compiled by the server.
I did not find out how to let the server compile the files correctly. However, I was able to resolve it by just compiling the code into Nuget packages before-hand. This can be done by using the dnu commandline tool.
dnu publish --out %folder% --no-source --include-symbols --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --configuration Release
The important part is the --no-source option, which will package into Nuget packages.

How to fix Newtonsoft.Json assembly loading error?

I'm attempting to load a pre-existing Umbraco CMS site into a Visual Studio project and am caught up in a bit of DLL hell.
Here is the error message I get when attempting to compile the site:
Could not load types from assembly Umbraco.Core, Version=1.0.5462.37503, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
I've attempted to re-install Newtonsoft from NuGet, re-install Umbraco from NuGet, delete all DLLs and re-install, removed the Newtonsoft dependentAssembly, every possible solution I've been able to find and this error continues to come up.
Any suggestions?
I'm guessing the binding redirect isn't set up correctly in the web.config file. Try running this in the nuget package manager console:
PM> Get-Project –All | Add-BindingRedirect
This ended up being a bit of a misunderstanding on my part from following the Umbraco videos. I was attempting to set up a new Visual Studio project, import all the DLLs needed, and then move the site content into the project.
All I really needed to do was create a blank project, then move the site content, with all of its DLLs, into the project. This let me immediately start editing the project.
The best solution was to install an earlier version of the package and then upgrade.

Cannot create or open projects in VS2012

I get this error when trying to create or open existing projects, VS 2012 on Windows 8
Could not load file or assembly 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I tried to remove and reinstall entity framework, but the installer tells me my computer already has it installed.

Binary compiled for VS2008 needs DebugCRT side-by-side assembly, doesn't work in VS2010

I'm working with VS2010 on a project that uses Havok, and the latest release only has VS2008 and earlier binaries. The embedded manifest generated by VS contains the following
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
Since apparently VS no longer uses side-by-side assemblies (source) starting with 2010, my winsxs directory doesn't have the debug crt assemblies installed, and the vs redistributable package doesn't install the debug versions. If we compile the dlls that use Havok with an embedded manifest, applications loading the dlls fail to start.
I ran sxstrace and got the following:
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at G:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.
The applications work on one of my coworker's machines, since (presumably) he had VS2008 installed on it, but not on another coworker's or mine, since we have only had VS2010 installed. The only debugcrt files the working machine has in the winsxs directory are
x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb
as a folder with the dlls, a .manifest file, and a .cat file (same publicKeyToken but different version)
I've tried copying the files over to my winsxs directory, which didn't fix the problem. Placing the dlls directly into the directory with the binaries also did nothing. Placing the files into bin\Microsoft.VC90.DebugCRT.DLL (since that was one of the directories searched according to sxstrace) also failed to help, but the output from sxstrace changed to
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at G:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: End assembly probing.
ERROR: Activation Context generation failed.
(it stops searching, and is able to resolve the reference but context generation still fails)
The only thing that works is disabling embedded manifest generation. Is there another way of resolving this?
On the working computer, look in the folder:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT
This is where the runtime dlls of the version needed to run are located. There is also a manifest file there. You can look in the event viewer (eventvwr.exe) to see which version of the DLLs the exe is looking for, and then you can modify the manifest file (rather, modify a copy that you place in the executable directory with the dlls) so it will identify the included files as being that version.

Resources