Visual Studio job to check .ASPX pages at compilation

Is it possible for Visual Studio to check .aspx pages for compilation errors? For example, if I have a web form with this control:

<asp:Button ID="CancelButton" runat="server" OnClick="CancelButton_Click" Text="Cancel" /> 

If CancelButton_Click does not exist in the code behind, ask VS to execute the error while compiling the application. Currently, it is still compiling, but it throws an error at runtime. Is it possible? I understand that compilation time will increase significantly, but it would be useful to catch problems before runtime. I thought I read about the possibility of doing this using Asp.Net MVC views, but cannot find the link.

+4
source share
1 answer

Yes, you need to compile using the deployment project and uncheck the box "allow this site to be updated." This compiles almost everything except a few small edgecases, such as xml serialization.

As you discovered, when compiling with F5, you really only compile half the code, and the rest compiles upon first request.

+4
source

All Articles