It’s really annoying that visual studio hides typos in aspx pages (not the code behind).
If the compiler would compile them, I would get a compile error.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Compile the pages at compile time. See Mike Hadlow’s post here:
http://mikehadlow.blogspot.com/2008/05/compiling-aspx-templates-using.html
Method 2
Go to your project properties. Go to the Build Events tab.
In the Post-build event command line: text area, write this (for .NET 4.0):
%windir%Microsoft.NETFramework64v4.0.30319aspnet_compiler.exe -v / -p "$(SolutionDir)$(ProjectName)"
Method 3
Resharper will catch errors in code ofASPX pages, all without compiling. works well imo, and better than later compiling.
EDIT: Resharper also has a Solution wide error checker. ‘Resharper->Windows->Errors in solution’. It will analyze your entire solution and give a consolidated list of everything it finds, INCLUDING aspx files.
Method 4
It is my belief you should always compile ASP.NET applications. There are a few instances where my clients requested otherwise. In Visual Studio, when you choose to publish your website, there is an option to have it compiled. Here is Microsoft’s MSDN article which offers their information on compiling sites.
http://msdn.microsoft.com/en-us/library/ms178466.aspx
HTML issues and such will show up as “warnings” and not errors. So, you’ll have to check the logs.
Method 5
There is the possibility to precompile the whole web: usually the pages only get compiled, if they are used.
To precompile the web, please refer to MSDN
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0