0
我正在MVC4中開發應用程序,現在我添加了新軟件包「mvcinstalled.mvc3」和「securityGuard」。執行後,我得到了一個錯誤。我知道這兩個軟件包都與剃鬚刀版本V1兼容,不適用於V2。任何人都可以建議任何解決方案如何從Razor V2遷移到V1或將完整的應用程序遷移到MVC3?從MVC4遷移到MVC3或將Razor版本V2更改爲V1
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to
[B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from
'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.
0__31bf3856
ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from
'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0
__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.InvalidCastException:
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to
[B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from
'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0
__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from
'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0
__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
有人有想法嗎? –