Why is my project building with an unknown Attribute?

旧街凉风 提交于 2019-12-13 02:58:46

问题


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

  • restarted VS many times
  • Deleted the .vs folder
  • Cleaned and Rebuilt the solution
  • deleted vs folder and restarted the computer

回答1:


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.



来源:https://stackoverflow.com/questions/47682949/why-is-my-project-building-with-an-unknown-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!