我的视图有错误。只有在Visual Studio中打开视图时才会看到这些错误。
我希望在编译时而不是执行时看到这些错误。
是否存在一种方法可以实现这种行为?
我的视图有错误。只有在Visual Studio中打开视图时才会看到这些错误。
我希望在编译时而不是执行时看到这些错误。
是否存在一种方法可以实现这种行为?
<MvcBuildViews>true</MvcBuildViews>
,这将随着您的操作编译视图。<!-- 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">
<AspNetCompiler VirtualPath="Temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
我想你在谈论C#编译错误,而不是像CSS验证错误之类的问题。
你可以做的一件事是将Web Deployment Project添加到你的解决方案中。当构建时,它会在你的项目上运行aspnet_compiler.exe,从而暴露任何这些C#编译错误在.aspx文件中,否则这些错误只能在运行时动态编译.aspx文件时才会显示出来。