ASP.NET MVC MiniProfiler and EntityFramework 6 Initialization

I have the same problem that after loading MiniProfiler and MiniProfiler.EnitiyFramework6 I have this problem. MiniProfiler works fine, but when I add to my Applcation_Start in Global.asax

MiniProfilerEF6.Initialize ();

I get this:

An exception of type "System.IO.FileLoadException" occurred in the MiniProfiler.EntityFramework6.dll file, but was not processed in the user code

Additional information: Failed to load the file or assembly "MiniProfiler, Version = 3.0.11.0, Culture = neutral, PublicKeyToken = b44f9351044011a3" or one of its dependencies. The located assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

+8
asp.net-mvc mvc-mini-profiler
source share
2 answers

Turns out this could be due to versions and identifiers. If you install MiniProfiler.EntityFramework6 without installing other packages, nuget will handle the dependencies, but it puts the wrong #s in web.config here (make sure the version number is correct):

<dependentAssembly> <assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.2.0.157" newVersion="3.2.0.157" /> </dependentAssembly> 

If you uninstall all MiniProfiler packages and then install in the following order:

Miniprofiler
MiniProfiler.MVC4
MiniProfiler.EF6

Everything seems to be fine.

+18
source share

For others having similar problems, here's how I solved

Analyze which version of Entity Framework your PM> Get-Package application uses.

and then install MiniProfiler.EF accordingly

As in my case, I installed Install-Package MiniProfiler.EF5

0
source share

All Articles