While my main application works fine, the unit test project is giving following error, when I try to execute "Mapper.AddProfile" method in initialiation of unit test project.
The type initializer for 'Foolproof.ContingentValidationAttribute' threw an exception.
Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have not used MVC 2.0.0.0 anywhere in my main project, and test project as well. Both these projects refer to MVC 4.0.0.0
what could be the possible issue?
Looks like the MVCFoolProof project has a reference to MVC2. See here: CodePlex Source Code - you could try pulling the source down and compiling it yourself against MVC4.
Related
I'm writing an MVC 4 Application that uses OAuth in Visual Studio 2012. I can compile without errors, but every time I run the application (previously working) I get the following error message.
Could not load file or assembly 'System.Web.WebPages.Razor,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
I haven't directly changed that package (System.Web.WebPages.Razor).
I have an ASP.NET MVC4 project which builds in TFS. Since adding the MiniProfiler to the project, the builds fail as follows:
CA0001 : The following error was encountered while reading module 'MiniProfiler':
Assembly reference cannot be resolved: System.Web.Mvc, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35.
CA0058 : The referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' could not be found. This assembly is required for
analysis and was referenced by: D:\Builds\...\my.dll,
D:\...\packages\MiniProfiler.2.0.2\lib\net40\MiniProfiler.dll.
DotPeek shows me that MiniProfiler does indeed reference System.Web.Mvc Version 3.0.0.0
Has anyone run into this issue? Is there a solution?
I would install MVC3 on the build server, however I don't have admin permission to do it. Someone can do it for me next week but if possible I'd like to avoid that.
The cause of this was actually Code Analysis. We had analysis set to run on build, and the build server was not able to load the needed assemblies during analysis for some reason. I am still not sure of the root cause, but turning off code analysis solved the problem.
Create a fresh Sharp Architecture project.
Successfully build, create DB, run Web app.
Attempt to add a new entity to the database via the web View.
Get the error:
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Issue:
The Newtonsoft.Json package was not updated due to the -Safe param added in the Sharp Architecture instructions
Solution:
Manually update the NewtonSoft.Json package via the Package Manager Console:
Update-Package Newtonsoft.Json
Update the binding references for each project that includes that package via the Package Manager Console:
Add-BindingRedirect
So i've just installed miniprofiler.mvc to my web project and it seems to be working fine.
Except I cant figure out what to do to set up EF Code First and the docs seem to be outdated.
My project has a MyApp.DAL project where the EF stuff lives.
What do I need to do to start profiling EF? please help?
UPDATE:
I have installed MiniProfiler.EF 2.0.2 and now I get
Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Have you made sure to install the EF package from Nuget?
http://nuget.org/packages/MiniProfiler.EF
PM> Install-Package MiniProfiler.EF
i've "fixed" it by simply adding EF to my Web Project
This is not ideal but it will do for now.
I opened up the DLL for an ASP.NET MVC 2 project of mine in Reflector, and noticed that there are two references to System.Web.Mvc - one for version 1.0.0.0, and one for 2.0.0.0. I don't seem any references to v1 anywhere in the csproj file, nor in my web.config file, but when I try to run the app I get the error Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
Where would the dependency on v1 be coming from?
You probably have an indirect reference to v1 through a different assembly.