我的观点有错误。只有在Visual Studio中打开视图时才会看到这些错误。
我希望在编译时看到错误而不是执行时间。
是否存在获取此行为的方法?
答案 0 :(得分:4)
您可以手动更新.csproj文件,并添加一个<MvcBuildViews>true</MvcBuildViews>
,可以随时编译视图。
以下是我googled的链接,您也可以找到其他链接。
编辑:如果速度太慢,请尝试仅针对Release设置构建,编辑csproj文件,执行此类操作;有关详细信息,请参阅AspNetCompiler的文档。
<!-- 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>
答案 1 :(得分:0)
我假设您正在讨论C#编译错误而不是CSS验证错误。
您可以做的一件事是在解决方案中添加Web Deployment Project。在构建时,它将在您的项目上运行aspnet_compiler.exe,这将暴露.aspx文件中的任何这些C#编译错误,否则在运行时即时编译.aspx文件之前不会指示。