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.
Notice, the 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
Some of the things I have already done
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 another error. But it seems this was not the right thing to solve this problem. Instead this seems to be right fix for my original problem.