Sharp Architecture - NewtonSoft.Json assembly mismatch - asp.net-mvc

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

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

Specify dependencies for inclusion in nupkg

I'm trying to release a library on nuget, but when trying to install it, it says that it can't find the dependency.
I'm using paket and a paket.template in order to generate the nupkg. I have no real idea how dependency resolution happens in F#/.NET, but it looks like in my .fsproj file, it's referencing a relative path.
The dependency I'm trying to include is Colorful.Console.
In my .fsproj, it references it like:
<Reference Include="Colorful.Console">
<HintPath>..\packages\Colorful.Console\lib\net461\Colorful.Console.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
which works fine locally, and seems to have no apparent problems during paket pack, but when installing in a different project from the remote source (also using paket), it tells me that MyLibrary can't find dependency 'Colorful.Console'.
It's in my library's dependencies with nuget Colorful.Console, and that dependency seems to be carried through, as Colorful.Console is in the packages folder of my other project (and shows up under 'References' in Visual Studio).
I've included the example project here: https://github.com/deecewan/GenbankDemoProject
Here is the library project, and more directly the paket.template used to generate the package.
Edit: I have updated my project thanks to advice from #rmunn - it is now meant to load the Colorful.Console version from net461 when the framework is net472. This is what I want/expect, I think. However, I still get the following error:
parse error FS3053: error : The type provider constructor has thrown an exception: Could not load file or assembly 'Colorful.Console, Version=1.2.9.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Attached below is a screenshot of the references of the project - GenbankTypeProvider and Colorful.Console are both included.

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.

Getting WebGrease exception while starting application

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.

MVCFoolProof does not work with AutoMapper in my Unit test project

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.

Resources