CS0246 类型或命名空间名称 'ErrorViewModel'找不到(您是否缺少 using 指令或程序集引用?) [英] CS0246 The type or namespace name 'ErrorViewModel' could not be found (are you missing a using directive or an assembly reference?)

查看:68
本文介绍了CS0246 类型或命名空间名称 'ErrorViewModel'找不到(您是否缺少 using 指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到 CS0246 错误代码.我正在做一个 MVC .net 核心项目.我在我的 C# 代码中加入了 Razor.我在进行构建时收到此错误.我在最后一行出现错误.谁能帮我解决这个问题?

I am getting a CS0246 error code. I am doing a MVC .net core project. I am incorporating Razor in my C# code. I received this error having doing a build. I am getting an error on the last line. Could anyone help me figure this out?

    [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"d6a5625cc8fb4476f348b0fe9041c550465d8bf9", @"/Views/Shared/Error.cshtml")]
    [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"53c99bf587b2b24ba6d4f1516a026a5e81271c09", @"/Views/_ViewImports.cshtml")]
    public class Views_Shared_Error : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<ErrorViewModel>

推荐答案

在 Error.cshtml 页面的顶部添加 @model libraryname.ErrorViewModel 而不是 ErrorViewModel.然后重建项目,看看它是否有效.

In Error.cshtml page add @model libraryname.ErrorViewModel at the top of the page instead of just ErrorViewModel. Then rebuild the project and see if it works.

这篇关于CS0246 类型或命名空间名称 &amp;#39;ErrorViewModel&amp;#39;找不到(您是否缺少 using 指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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