views:

75

answers:

2

I want to compile my ASPX pages so that if there is a bug in them it will tell me to fix it. Traditionally Visual Studio only compiles the code behind so I found recommendations to use Web Deployment Project.

I have done that but it builds successfully even though I have set a string value to an int member.

I expected it to error but nothing. Am I using the Web Deplyment Project the wrong way?

+1  A: 

Take a look at this question already on StackOverFlow>

How can I compile Asp.Net Aspx Pages before loading them with a webserver?

markoo
I did and that says to look at the Web Deployment Project.
Jon
In the blog from the answer there is a reference to the command line tool aspnet_compiler. Did you use this in your post build event as it explains?http://mikehadlow.blogspot.com/2008/05/compiling-aspx-templates-using.html
markoo
I ended up modifying the csproj file as per the link in the comments section
Jon
+1  A: 

You can use the asp.net compiler which will compile all your files into DLLs. you dont even need to deploy the aspx files with the project.

The result of compiling your project files using asp.net compiler is similar to the runtime compile of files when you access them through a browser. Therefore any compile errors will be alerted to you without you having to upload the files to a test or even live server.

This tool is great used in conjunction with nant to build, compile and run tests on your project before commiting your changes to source control and Continuous Integration Server.

asp.net Compiler

skyfoot