본문 바로가기

.Net

ASP.NET MVC 업그레이드 (MVC3에서 MVC4)

 
  • 기본참조  
Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4


  • 적용사항(기본참조기준)
# AS-IS
System.Web.Mvc, Version=3.0.0.0
System.Web.WebPages, Version=1.0.0.0
System.Web.Helpers, Version=1.0.0.0
System.Web.WebPages.Razor, Version=1.0.0.0

# TO-BE
System.Web.Mvc, Version=4.0.0.0
System.Web.WebPages, Version=2.0.0.0
System.Web.Helpers, Version=2.0.0.0
System.Web.WebPages.Razor, Version=2.0.0.0

  • ControllerBase.cs 내 추가
protected override bool DisableAsyncSupport
{
    get { return true; }
}

# 참조
현재 프로젝트는 모든 컨트롤러가 Controller 을 상속받은 ControllerBase 클래스를 상속받도록 되어 있다.
public abstract BaseController : System.Web.Mvc.Controller
public class MainController : BaseController


https://msdn.microsoft.com/en-us/library/system.web.mvc.controller.disableasyncsupport(v=vs.108).aspx

This flag is for backwards compatibility. ASP.NET MVC 4. allows a controller to support asynchronous patterns.
This means ExecuteCore doesn't get called on derived classes.
Derived classes can override this flag and set to true if they still need ExecuteCore to be called.

이 플래그는 이전 버전과의 호환성을위한 것입니다. ASP.NET MVC 4. 컨트롤러가 비동기 패턴을 지원할 수 있습니다.
이 ExecuteCore가 파생 클래스에서 호출되지 않습니다 것을 의미합니다.
파생 클래스는이 플래그를 무시하고 그들은 여전히 ExecuteCore 호출 할 필요가있는 경우 true로 설정할 수 있습니다.


  • 프로젝트 GUID 변경

프로젝트의 mvc 버전을 변경하면 프로젝트 파일의 GUID를 알맞게 변경해주여야 한다.
즉, MVC2 버전에서 MVC3 버전으로 업그레이드 하는경우

{F85E285D-A4E0-4152-9332-AB1D724D3325} ==> {E53F8FEA-EAE0-44A6-8774-FFD645390401}
로 변경해주어야 추후 환경셋팅시 MVC2를 설치하지 않아도 프로젝트의 오류가 발생하지 않는다.