How to fix 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.
Using VB 2022 and I have this issue that I can not get resolved.
using .net framework 4.8 and I tried using x64, x86 and nothing has worked
Visual Studio
C#
Visual Studio Debugging
-
Tianyu Sun-MSFT 30,811 Reputation points • Microsoft Vendor
2023-02-14T07:26:12.34+00:00 Hello Tyrique,
Welcome to Microsoft Q&A forum.
Please let us know what you had done before this error appeared:
- Did you install log4net NuGet package?
- Did you write some code?
- Did you modify some configurations?
- Does this error appear in a newly created project? If so please share us the detailed steps to reproduce this issue and check further.
-
Tyrique 0 Reputation points
2023-02-16T10:01:01.2766667+00:00 I did not install log4net NuGet pacakage
I didnt write some code but I did indeed change some configurations changing the frame network to 4.8 and the preferred cpu to x64It is also good to mention this is not my code.
-
Tianyu Sun-MSFT 30,811 Reputation points • Microsoft Vendor
2023-02-16T10:01:41.6466667+00:00 Hi Tyrique,
Please try to install the corresponding log4net NuGet package and check the code about the Crystal Report. Please share us more information like code snippets and minimal reproducible sample to check further.
Regards,
Tianyu
-
Tianyu Sun-MSFT 30,811 Reputation points • Microsoft Vendor
2023-02-20T09:47:28.56+00:00 Hi Tyrique,
May I ask if your issue was resolved? Please let me know if there is anything that I can help here.
-
Tyrique 0 Reputation points
2023-02-21T14:31:13.02+00:00 How exactly do i install the log4net NuGet package and run it so that the error message no longer appears and I am not quite sure about the crystal report code. I will share more code snippets as I still have the same Issue.
Error List.pdf -
Tianyu Sun-MSFT 30,811 Reputation points • Microsoft Vendor
2023-02-24T08:42:05.83+00:00 Hi @Tyrique,
You can right-click your project > Manage NuGet Packages… > switch to Browse tab > search and install the related version of the log4net NuGet package, after that rebuild your project.
For the second error => The variable
CrystalReportViewer1
is either undeclared or was never assigned, did you install Crystal Reports? I may suggest you also addVB
tag for better help. -
Muh Faiz Azhar 0 Reputation points
2024-02-19T10:31:40.26+00:00 i have the same 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. (Exception from HRESULT: 0x80131040)"
but it is happened after i deploy to server. my app is doing normal in my local PC -
Tianyu Sun-MSFT 30,811 Reputation points • Microsoft Vendor
2024-03-27T05:56:43.71+00:00 Hello @Muh Faiz Azhar ,
If you are using log4net and .net framework, please try to add bindingRedirect into the App.config file. For example:
<dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="xxxxxxxxxxxxxxxx" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.10.0" newVersion="2.0.17.0" /> </dependentAssembly>
newVersion
should be the version of log4net that you are using.If it doesn't work, I may suggest you check your project(like project file => .xxproj). Find the specific version of log4net which is referenced in your project. Search for log4net version 1.2.10.0 in your system and consider replacing it to the specific version of log4net that your project is referenced.
Also please try to clean your project cache(remove .vs/bin/obj folders) and rebuild, deploy your project again.
Sign in to comment