Using White from NuGet

Aug 7, 2012 at 6:05 PM

Hi I am trying to use White from NuGet.

I have added package White 0.2.0 from the NuGet package manager.  It all got installed and added to my project OK, along with all it's dependencies - Bricks, Castle, log4net etc.

All build fine.

However, at runtime I get an assembly load exception:

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. 

Looking at the version of log4net referenced by the White.Core assembly, it's version 1.2.10.0 as is appearing in that error above.

However it has loaded log4net v1.2.11.0 into my project.

I tried a simple assembly binding redirect to try and get it to load 1.2.11.0 when an older version was requested:

      <dependentAssembly>
        <assemblyIdentity name="log4net" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.2.10.0" newVersion="1.2.11.0" />
      </dependentAssembly>

However this didn't work.

On closer inspection it seems that log4net 1.2.11.0 has a DIFFERENT public key that 1.2.10.0!

Has anyone come across this problem?

Any ideas on a nice way to solve it?

Anyone successfully using White via NuGet???

 

Aug 8, 2012 at 10:46 AM

So I think I got around the problem by forcing the older version of log4net to be used instead of 1.2.11.0.

Here is my full workaround in case anyone runs into the same issue:

1. Add White via NuGet package manager as usual
2. Go into packages.config and change the log4net version from 2.0.0 to 1.2.10
3. Rebuild the project (which should load the older log4net package)
4. Unload the project and edit the project file
5. Locate the hint path for the log4net reference and change it from ..\packages\log4net.2.0.0\lib\net40-full\log4net.dll to ..\packages\log4net.1.2.10\lib\2.0\log4net.dll
6. Reload the project
7. Save All
8. Close the solution
9. Open the solution
10. Clear All
11. Rebuild All
12. Done!