![](/img/trans.png)
[英]Type or namespace name could not be found (missing using directive or assembly reference?)
[英]The type or namespace name 'MyApplication' could not be found (are you missing a using directive or an assembly reference?)
我有一個舊的 ASP.NET C# web 應用程序,我正在嘗試在 Visual Studio 2015 中升級和更新。
打開項目並嘗試構建它后,出現以下錯誤:
找不到類型或命名空間名稱“MyApplication”(您是否缺少 using 指令或程序集引用?)
Global.asax
:
<%@ Application Codebehind="Global.asax.cs"
Inherits="MyApplication.MvcApplication" Language="C#" %>`
Global.asax.cs
:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace MyApplication
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Data", action = "WarehouseDataReview", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
}
}
我試過的:
System.mvc
引用這解決了我的問題。 使用我們的 web 項目創建了一個新的解決方案。 添加了舊的 C# 項目並刪除了新的項目。 它工作正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.