I\'ve got a VS2017 project that compiles to a DLL which is then called by an EXE written by someone else. Both projects target .Net Framework 4.6.2. I rewrote one of my DLL
If you have AutoMapper
version 8.0 or lower referenced in any of your projects, it's possibly the source of the issue. See this github issue for more information.
If I understand correctly, the issue is that .NET Framework versions below version 4.7 did not have System.ValueTuple
shipped with them by default, so AutoMapper
was using a NuGet package reference for the assembly since it has build targets for Framework versions below 4.7. This caused some funky Microsoft stuff.
The easiest solution is to upgrade your AutoMapper
references to version 8.1.0
or newer, where they have scraped all uses of the assembly from their codebase and removed the dependency.
I just had this issue myself. Not on Localhost while developing, but only on production server. In the end it turned out to be some sort of conflict between .Net Framework 4.6.1 and me having System.ValueTuple installed from Nuget in version 4.5.0.
The solution turned out to be, to downgrade the System.ValueTuple Nuget package to 4.3.0. Then it worked, like nothing had ever been an issue.
I suspect that this only happened on production server, cause of a different version of .net framework installed.
Solved it by installing VS 2019.
I resolved this issue by registering System.ValueTuple in my computer's machine.config file (along with my own DLL which was already registered there). I don't particularly like this approach though since it's dependent upon the DLL version which is subject to change at any time. Hopefully MS will just add this assembly to the next version of the .Net Framework.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ffffd51" />
<bindingRedirect oldVersion="0.0.0.0-99.99.99.99" newVersion="4.0.1.0" />
<codeBase version="4.0.1.0" href="e:\exec\System.ValueTuple.dll" />
</dependentAssembly>
...
</assemblyBinding>
</runtime>
IF your are unable to update .Net Framework to the latest version, then downgrade Package: Microsoft.Net.Compilers to the version up to 2.10. This solved the issue in my case.
I experienced the same error "Could not load file or assembly System.ValueTuple.dll..." on my Windows Server 2016. However, the site worked fine on my dev machine.
My solution was simple, I grabbed this dll from my dev machine and dropped it in the site's "bin" folder on the server. It worked.