So, my code seems to be compiling without errors when it should not compile.
Here, this project has no NuGet packages for AspNetCore.Mvc and hence this should not compile but still it does.
ModleBinder is in white color which means it does not recognize this type - still it is compiling.
In another console app of the same VS this behaves fine.
I am using VS 2017 15.4
<a href="https://i.stack.imgur.com/e2PyR.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/e2PyR.png" data-original="https://i.stack.imgur.com/e2PyR.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>
Some of the things I have already done<ul><li>restarted VS many times</li> <li>Deleted the .vs folder</li> <li>Cleaned and Rebuilt the solution </li> <li>deleted vs folder and restarted the computer</li> </ul>Answer1:
So, I have found the root cause.
The root cause of the mentioned issue is this line in the .csproj file
<PropertyGroup> <EnableDefaultCompileItems>false</EnableDefaultCompileItems> </PropertyGroup>
I had to add this line to avoid <a href="https://stackoverflow.com/questions/43325916/duplicate-content-items-were-included-the-net-sdk-includes-content-items-f" rel="nofollow">another error</a>. But it seems this was not the right thing to solve this problem. Instead <a href="http://jameschambers.com/2017/11/duplicate-compile-items-included/" rel="nofollow">this seems to be right fix</a> for my original problem.