为什么我的项目建筑的属性未知? [英] Why is my project building with an unknown Attribute?

查看:100
本文介绍了为什么我的项目建筑的属性未知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我的代码在不应该编译时似乎没有错误.

在这里,此项目没有用于AspNetCore.Mvc的NuGet程序包,因此不应编译,但仍可以编译.

注意,ModleBinder为白色,这意味着它无法识别此类型-仍在编译中. 在同一个VS的另一个控制台应用程序中,此行为很好.

我正在使用VS 2017 15.4

我已经做过的一些事情

  • 多次重启VS
  • 删除了.vs文件夹
  • 清理并重建了解决方案
  • 删除vs文件夹并重新启动计算机

解决方案

所以,我找到了根本原因.

提到的问题的根本原因是.csproj文件中的这一行

 <PropertyGroup>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
 </PropertyGroup>

我必须添加此行以避免这似乎是正确的解决方法./p>

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

解决方案

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.

这篇关于为什么我的项目建筑的属性未知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆