0

I'm currently getting an exception on a few React components. If it helps, I'm using .NET 4.6.2 and am new to working with .NET and a lot else on this inherited project. The error is this:

**System.IO.FileLoadException:** 'Could not load file or assembly 'System.Buffers, Version=4.0.0.0, Culture=neutral, PublicKeyToken='cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

I note that I have two different System.Buffers folders in my packages - one for 4.0.0 and one for 4.4.0. If I try to delete them, they seem to just come back, even if I delete the bin and obj folders between cleans/rebuilds. That's not the main issue, but it may provide context.

I've tried several things to fix this, much of which came from ideas found here: Could not load file or assembly 'System.Buffers, Version=4.0.2.0...'

But crucially, the one idea I can't test is that of placing an assembly reference in my Web.config. Every time I add it and then run the project, it automatically deletes what I've written. Everything else stays, but everything between the <dependentAssembly></dependentAssembly> tags for my reference gets erased on start-up. I can't find anything about why this happens. I feel like this might provide a solution to the overall problem, so I'm really here for help with this specific part of the issue but any help anyone can provide for the overarching problem would be much obliged.

It might also be worth noting that when I clean and rebuild the project, I get a notice about many of my packages and how they'd be better off being remapped, which is why that's what I'm trying to do. It suggests "Consider app.config remapping of assembly "System.Buffers (with culture, public key etc.) from Version "4.0.0.0" [] to Version "4.0.2.0"" which is why I think that this might be the solution if I can Web.config to cooperate.

I've tried deleting each of the System.Buffers folders and they keep coming back, but I don't think that's going to fix it anyway. The project is always trying to find version 4.0.0.0 of System.Buffers, and is only finding 4.0.2.0. So I'm trying to redirect it by placing this in my Web.config file in the runtime section with all the other assembly references:

<dependentAssembly>
    <assemblyIdentity name="System.Buffers" publicKeyToken="c7b13ffcd2ddd51" culture=" neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.0.2.0" />
</dependentAssembly>

But as I say, upon running the project, everything in the above is simply deleted. I've also tried placing this in the Web.config file within my Views folder. It doesn't erased from the Views Web.config, but it doesn't seem to fix the problem, either.

James-VT
  • 1
  • 1

0 Answers0