I have a solution with a couple of library projects (data access, business layer etc) which also includes a Visual WebGui project. In this last project I was testing during the last few days the log4net library (for logging purposes). In this solution I added a new WiseJ project for testing, after updating to the latest 1.2.15 version. It was working alright, up to the point I added a UserControl. After that point the UserControl and all other windows/forms etc I had added to the Wisej project do not open in the designer anymore, giving the error shown in the attached picture. The error says:
“Could not load file or assembly ‘log4net, Version 22.214.171.124, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a’ or one of its dependencies….”
The log4net is NOT included (either referenced or added to Web.config) in the Wisej project. It MUST be a coincidence (but a VERY strange one!) that both Wisej and log4net versions are 1.2.15.
It is not a real problem as I said this is a test project and I could delete it without a second thought. But I thought I should report it in case it points you to any deeper problem.
All the best,
We don’y use log4net. It looks like an assembly in the project is referencing it. VS designer has a tendency to copy the assemblies it uses and sometimes it keeps loading a cached build. One way to reset it is to clear, rebuild, close and reopen VS.
Referenced assemblies are usually loaded when a method using it or a derived class is loaded. Something at design time must have triggered it. Can you check if a referenced custom assembly (not Wisej) references log4net?
Luca, you are right! Cleaning the solution, exiting VS and reopening it did the trick. So it turns out it was a caching problem.
Many thanks, Alex
I can see from the stack trace that the assembly loading is triggered by Wisej inspecting the referenced assemblies for resources. We’ll wrap that in a try/catch and rethrow a more meanigful exception with the name of the assembly that failed.
Continuing … I used the NuGet manager for the solution to install the log4net package to the Wisej project. Now the designer does not complain anymore for missing log4net, but another 3rd party package installed in other projects in the solution. Very confused …