【问题标题】:ASP.Net MVC 4 – Resource Cannot be found errorASP.Net MVC 4 – 找不到资源错误
【发布时间】:2014-05-05 06:40:01
【问题描述】:

我的项目直到昨天都运行良好,今天我将命名空间从 OnlineShoppingSystemMVC 重命名为 OnlineShoppingSystemMvc

然后我更改了 Global.asax 我更改的标记

<%@ Application 
Codebehind="Global.asax.cs"
Inherits="OnlineShoppingSystemMvc.MvcApplication" 
Language="C#" %>

但在调试应用程序时仍然会抛出资源找不到错误。

请帮我解决这个问题。

【问题讨论】:

  • 我用ctrl+r改了,r改了名字空间
  • 清理并重建解决方案并确保命名空间已重命名所有地方
  • 我按照你的建议做了,但还是没有运气
  • 问题是我确信在某些地方使用了旧的命名空间名称。
  • 好的,我再检查一遍

标签: asp.net-mvc asp.net-mvc-4 global-asax


【解决方案1】:

你必须重命名所有

@model OnlineShoppingSystemMVC.YourModelsFolder.YourModel

@model OnlineShoppingSystemMvc.YourModelsFolder.YourModel 在您的所有查看文件中

现在我做了你之前做的事情(我重命名了我的一个项目的命名空间 (ctrl+R))并且所有命名空间都被重命名了,但是我的视图中模型的命名空间没有改变。

【讨论】:

    【解决方案2】:
    I find solution for your issue:
    
    My project name is WebApplication1 after this rename it to WebApplication3 .
    
    I was  change  this line in aspx page:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" **Inherits="WebApplication3.test"** %>
    I done changes also in AssemblyInfo.cs :
    **[assembly: AssemblyTitle("WebApplication3")]**
    and **[assembly: AssemblyProduct("WebApplication3")]**
    
    and also change in test.aspx.cs:
    
    **namespace WebApplication3**
    
    after this running project it works absolutely fine.
    Hope it will help you
    

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 2012-03-06
      • 1970-01-01
      • 2014-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多