Not seeing this exact situation in the question search.
I added a net framework 4.7.2 library to a web page solution with 3 projects in it that were all 4.7.1. It worked fine until I actually tried to reference an object in the 4.7.2 library.
I figured out the problem, and set every project to 4.7.2.
It builds perfectly fine. But when I run it, I get this error:
Compiler Error Message: CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Line 82: <img src="/images/0421-NV.png" class="img-responsive" />
Line 83: <div class="textDiv">
Line 84: @Html.Snippet("mysnippetname") <<-- this line is highlighted
Line 85: </div>
Line 86: </div>
I'm stumped as to why it's demanding a netstandard reference when I don't have any netstandard projects in the solution. It also didn't complain about it before when I was using 4.7.1. I didn't add any new code between when it was using 4.7.1 and compiled and ran.
Any ideas?
Edit: I changed everything to 4.7.1 to test, and it still gives me the same error.
Edit2: I did try adding the following to the web.config but I still get the same error:
<system.web>
<httpRuntime targetFramework="4.6.1" maxRequestLength="32768"/>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
</compilation>