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

新建好项目后,把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>前面加上以下内容:

 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>

,之后重新编译,问题就解决了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值