您的位置:首页 > 编程语言 > ASP

asp.net mvc4 设置build项目时,编译view页面

2015-11-25 00:16 531 查看
新建好项目后,把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文件,

1.1,)设置MvcBuildViews属性为true;

<MvcBuildViews>true</MvcBuildViews>


1.2,)在</Project>前面加上以下内容:

<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target> -->
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
</Project>


,之后重新编译,问题就解决了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: