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.
In order for the ASP.NET engine to service a request for this page, the page's code portion (the WebPage. aspx. cs file) must first be compiled. This compilation can happen explicitly or automatically.
By default, ASP.NET Web pages and code files are compiled dynamically when users first request a resource, such as an ASP.NET page (. aspx file), from a Web site.
Performing Precompilation You can precompile a Web site using the Aspnet_compiler.exe tool on the command line. For more information, see How to: Precompile ASP.NET Web Sites for Deployment and ASP.NET Compilation Tool (Aspnet_compiler.exe). Visual Studio also includes commands to precompile a Web site from the IDE.
Compile the pages at compile time. See Mike Hadlow's post here:
http://mikehadlow.blogspot.com/2008/05/compiling-aspx-templates-using.html
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.NET\Framework64\v4.0.30319\aspnet_compiler.exe -v / -p "$(SolutionDir)$(ProjectName)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With