我最近从 MVC2 升级到 MVC3。我们曾经使用 Spark 视图引擎,我正在尝试开始迁移到 Razor。至此升级到 MVC3 是成功的。我也升级了 Spark 视图引擎,因为我需要这样做。
问题是我能够成功渲染 Spark 和 Razor 视图,但由于某种原因,MVC 正在一个位置查找 Spark 文件,而在另一个位置查找 Razor。好像 Razor 没有正确考虑我的区域,但 Spark 是。
输出:
<pre>
The view 'index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Areas/Live/Views/multimedia/index.aspx
~/Areas/Live/Views/multimedia/index.ascx
~/Areas/Live/Views/Shared/index.aspx
~/Areas/Live/Views/Shared/index.ascx
~/Views/multimedia/index.aspx
~/Views/multimedia/index.ascx
~/Views/Shared/index.aspx
~/Views/Shared/index.ascx
~/Areas/Live/Views/multimedia/index.cshtml
~/Areas/Live/Views/multimedia/index.vbhtml
~/Areas/Live/Views/Shared/index.cshtml
~/Areas/Live/Views/Shared/index.vbhtml
~/Views/multimedia/index.cshtml
~/Views/multimedia/index.vbhtml
~/Views/Shared/index.cshtml
~/Views/Shared/index.vbhtml
Live\~\Areas\Live\Views\multimedia\index.spark
Live\~\Areas\Live\Views\Shared\index.spark
Live\multimedia\index.spark
Live\Shared\index.spark
Live\~\Areas\Live\Views\multimedia\index.shade
Live\~\Areas\Live\Views\Shared\index.shade
Live\multimedia\index.shade
Live\Shared\index.shade
~\Areas\Live\Views\multimedia\index.spark
~\Areas\Live\Views\Shared\index.spark
multimedia\index.spark
Shared\index.spark
~\Areas\Live\Views\multimedia\index.shade
~\Areas\Live\Views\Shared\index.shade
multimedia\index.shade
Shared\index.shade
</pre>
如果我将 .cshtml 文件移动到 MVC 想要的位置,它将起作用,但这不会削减它。为什么这两个引擎的位置会略有不同?