在ASP.NET MVC应用程序中看不到资源名称空间 [英] Can't see Resources namespaces in ASP.NET MVC application

查看:82
本文介绍了在ASP.NET MVC应用程序中看不到资源名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一切都很好,但是突然资源停止工作. 我有ASP.NET MVC5应用程序.

Everything was fine but suddenly Resources stopped working. I have ASP.NET MVC5 Application.

我所看到的只是消息:

错误3:类型或名称空间名称用户"不存在 在名称空间"MyProject.Resources"中(您是否丢失了 组装参考?)

Error 3: The type or namespace name 'User' does not exist in the namespace 'MyProject.Resources' (are you missing an assembly reference?)

但是,此问题仅在 .cs 文件中!在视图中,一切正常! 例如,我在某些控制器中看到的只是 Resources.App_LocalResources ,但这是空的名称空间.在 .cshtml 文件中,我看到了所有我的资源! Visual Studio似乎有些问题,因为它突然发生了.以前一切都很好. 有什么想法吗?

But, this problem is only in .cs files! In Views everything is OK! All I see for example in some controller is Resources.App_LocalResources but this is empty namespace. In .cshtml file I see all my resources! It looks like some problem with Visual Studio, because it happend suddenly. Earlier everything was fine. Any ideas?

我已经多次重新启动Visual Studio,甚至还恢复了计算机.但是什么都没有改变.

I have already restarted Visual Studio many times, I have resterd even computer. But nothing's changed.

问题已解决. 我已经将我的Resources项目的.csproj替换为旧版本.我不得不再次添加一些文件,但是现在一切正常. 因此它已损坏了项目文件.

Problem solved. I have replaced .csproj of my Resources project to older version. I had to add again few files but now everything's OK. So it was damaged project file.

推荐答案

右键单击Core/database项目时,可以执行卸载项目".再次右键单击项目文件,然后选择编辑".现在,您应该可以手动编辑csproj文件了. 尝试添加缺少的引用,或者如果它们指向构建的输出文件夹,则对其进行编辑

You can do "unload project" when right clicking on the Core/database project. Right click on the project file again selecting "edit". Now you should be able to manually edit the csproj file. Try adding the missing references, or editing them if they are pointing to the output folder of your build

这篇关于在ASP.NET MVC应用程序中看不到资源名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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