新建好項目后,把system.web.mvc.dll移除,重新選擇本地C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies下的system.web.mvc.dll,編譯出現問題提示:“The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc'”
切換回來對應新建時應用目錄下的system.web.mvc.dll依然出現問題。
讓view重新編譯:
1,)修改web解決方案.csproj文件,
idea運行html、1.1,)設置MvcBuildViews屬性為true;
<MvcBuildViews>true</MvcBuildViews>
1.2,)在</Project>前面加上以下內容:
1 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 2 Other similar extension points exist, see Microsoft.Common.targets. 3 <Target Name="BeforeBuild"> 4 </Target> 5 <Target Name="AfterBuild"> 6 </Target> --> 7 <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> 8 <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" /> 9 </Target> 10 </Project>
,之后重新編譯,問題就解決了。