VS2013 不编译 ASP.NET MVC5 视图 [英] VS2013 does not compile ASP.NET MVC5 views
问题描述
我的 Visual Studio Ultimate 2013 Update 4 无法编译 ASP.NET MVC 5 视图.
My Visual Studio Ultimate 2013 Update 4 does not compile ASP.NET MVC 5 views.
偶尔会在视图上发现编译错误,尽管编译总是成功的.Intellisense 也在视图中打开和关闭.我会说它在 VS2012 中工作得更好(我在那个版本上没有太多的 MVC).
Compilation errors are spotted on views sporadically, although compilation is always successful. Intellisense is also on and off on the views. I would say it was working significantly better in VS2012 (I did not much MVC on that version).
我尝试将 <MvcBuildViews>true</MvcBuildViews>
添加到 .csproj 文件中,该文件用于在 VS2010 中工作,但它不再工作了.
I have tried to add <MvcBuildViews>true</MvcBuildViews>
to the .csproj file, thing that uses to work in VS2010, but it is not working anymore.
知道可能是什么问题吗?
Any idea what could be the problem?
更新:我正在寻找查看视图错误的方法,因为它发生在以前版本的 VS 中.
推荐答案
您的项目是否包含目标并在构建事件后挂钩?从命令行尝试 msbuild WebApplication1.csproj/t:MvcBuildViews
,它会检查您是否已定义默认属性集和目标.
Does your project include the target and hook into after build event? Try msbuild WebApplication1.csproj /t:MvcBuildViews
from command line, it'll check that you have both default property set and target defined.
<PropertyGroup>
<MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
尝试从 VS2013U4 中创建一个空白的 MVC 项目,并将 csproj 与您的进行比较.
Try creating a blank MVC project from within the VS2013U4 and compare the csproj to yours.
这篇关于VS2013 不编译 ASP.NET MVC5 视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!