在 MVC Controllers 加入 具有檢視、使用 Entity Framework 的 MVC 5 控制器,View 端噴錯噴得亂七八糟的,但要是按執行還是很神奇的可以跑起來。
Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value 'Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNet.Mvc.Razor'. Error: Object reference not set to an instance of an object
The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' after add controller with view
或
The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
還有
'_Page_views_home_index_cshtml.ExecuteAsync()': no suitable method found to override
結論是要清 VS ComponentModel 的快取
C:\Users\[Username]\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
把這個資料夾刪掉再重開 VS 等個兩秒它就會自己校正到正常了。
ref: SO
沒有留言:
張貼留言