c# - cs7003 意外使用未绑定(bind)的通用名称

标签 c# asp.net-mvc-5

我在 Visual Studio 中遇到此错误:

Error CS7003 Unexpected use of an unbound generic name MyProject C:\Users[myname]\documents\visual studio 2015\Projects....\Index.cshtml 1

有问题的文件就在这里(第 1 行错误是对模型声明的引用):

@model MyProject.Models.MyAccount.Details
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_PrimaryLayout.cshtml";
}
<!-- Page Content -->
<div class="container">
.... more page stuff follows from here

模型类如下:

namespace MyProject.Models.MyAccount
{
    public class Details
    {
        public static Details Select(Company c)
        {
            Details model = new Details();
            model.SomeProperty = "SomeValue";


            return model;
        }

        public String SomeProperty { get; set; }
    }
}

奇怪的是,清理并没有让它消失,重建让它留在那儿,我构建/调试得很好。

最佳答案

需要关闭 Visual Studio 并重新启动才能清除错误。随后的重建不会产生错误。

关于c# - cs7003 意外使用未绑定(bind)的通用名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34456200/

相关文章:

c# - F# 中的 CGRect - 未定义

c# - FunctionIncationFilterAttribute 位于哪里?

c# - 反序列化具有抽象类型属性的对象

javascript - 在页面加载时检查 md-radio-group

asp.net-mvc-5 - OWIN 是否调用 MVC (ASP.NET MVC)?

c# - 确定谁修改了某行代码(又名 "blame feature")

c# - 当客户端脚本显示时正确调整 ModalPopupExtender 的大小

c# - 如何在 ASP.net 中安全地延迟 Web 响应?

c# - Controller 中的 MVC5 不明确操作方法

asp.net-mvc - asp.net mvc 5 'ModelType' 未声明