Getting WebGrease exception while starting application - asp.net-mvc

I was getting System.Web.Razor version conflict exceptions after I installed DotNetOpenAuth. So, I reverted the packages and uninstalled DotNetOpenAuth for now. But now I am getting below exception since long time -
Could not load file or assembly 'WebGrease, Version=1.5.1.25624, 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)
Why is this happening? And how to resolve this?

did you tried re installing the Microsoft.AspNet.Web.Optimization through Package Manager Console? That should resolve the dependencies.

Related

Error when trying to build solution in TFS 2015 sp3 - can't figure it out

We are developing with VS2019, managing all code and builds in On-Prem TFS 2015 service pack 3.
Been running into the following TFS build issue and can't figure out what the real problem is. I verified the FxCopAnalyzers in the solution/projects are installed via Nuget and checked into TFS. This all builds fine locally on my sandbox workstation. The TFS warnings claim the file(s) cannot be found, but they are there. Very frustrating.
In the build config > process tab, the solution is using the Default v12 build template (as are ~50ish other builds) and I've set it to run as a CI build.
I'm missing something, but have been fighting this for so long I think I have tunnel vision. What could the real problem be? Any help is much appreciated. Thanks in advance.
CSC: An instance of analyzer Microsoft.CodeAnalysis.VersionCheckAnalyzer.AnalyzerVersionCheckAnalyzer cannot be created from E:\BuildAgentWorking\4\ACTS\ACTS v1.0 SLN (CI)\src\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.8\analyzers\dotnet\Microsoft.CodeAnalysis.VersionCheckAnalyzer.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
CSC: An instance of analyzer Microsoft.CodeQuality.CSharp.Analyzers.Maintainability.CSharpVariableNamesShouldNotMatchFieldNamesAnalyzer cannot be created from E:\BuildAgentWorking\4\ACTS\ACTS v1.0 SLN (CI)\src\packages\Microsoft.CodeQuality.Analyzers.2.9.8\analyzers\dotnet\cs\Microsoft.CodeQuality.CSharp.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
CSC: An instance of analyzer Microsoft.CodeQuality.Analyzers.Maintainability.DoNotIgnoreMethodResultsAnalyzer cannot be created from E:\BuildAgentWorking\4\ACTS\ACTS v1.0 SLN (CI)\src\packages\Microsoft.CodeQuality.Analyzers.2.9.8\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
CSC: An instance of analyzer Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.UriPropertiesShouldNotBeStringsAnalyzer cannot be created from E:\BuildAgentWorking\4\ACTS\ACTS v1.0 SLN (CI)\src\packages\Microsoft.CodeQuality.Analyzers.2.9.8\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
CSC: An instance of analyzer Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.AbstractTypesShouldNotHaveConstructorsAnalyzer cannot be created from E:\BuildAgentWorking\4\ACTS\ACTS v1.0 SLN (CI)\src\packages\Microsoft.CodeQuality.Analyzers.2.9.8\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
If you've referenced the Microsoft.Net.Compilers pacakge, update it to latest version. If not, add reference to its latest version.
If you have a version of Microsoft.CodeAnalysis.FxCopAnalyzers that is too high for your version of Visual Studio you can get this warning:
warning CS8032 ...
To find the max version supported see this documentation: Install FxCop analyzers in Visual Studio -> FxCopAnalyzers package versions

Umbraco 7 Could not load file or assembly

i downloaded Umbraco using WebMatrix, after updating Nuget packages it is finally giving error as below
Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).
Please suggest where I am doing wrong??
You should download the release version of Umbraco you currently have installed and then add a reference to the 'System.Web.Mvc.dll' that comes in the source files instead.
Umbraco Releases
ps. You can find the version of Umbraco installed by looking for and AppSetting named 'umbracoConfigurationStatus' in the web.config file.

downgrade from Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0 to Version 1.0.0.0

By Mistake i updated my references and it affected the identity.framework , i did some research and it's totally a new different version and i need to do a lot of things to make it work, so i decided to switch back to version 1.0.0.0 which worked good for me. but now i got this error message:
error 0004: Could not load file or assembly 'Microsoft.AspNet.Identity.EntityFramework, 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)
After 8 hours troubleshooting this problem i finally figured out what was the problem.
The error message is a little misleading , because the problem is not about Microsoft.AspNet.Identity.EntityFramework itself but it was about "one of its dependencies" . it was the EF. i had three projects and each project on the solution has a different version of the EF . 6.0.0,6.0.1 and 6.1.0 i think . I uninstalled all of them and left the version 6.0.0 and it works fine now.

Sharp Architecture - NewtonSoft.Json assembly mismatch

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

MiniProfiler with mvc 3 and ef 4.3

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.

Resources