By default Asp.Net web applications don’t compile aspx files (only the code behind). This means that you can have errors in them which don’t appear until you actually hit the page.
To change this so that your aspx files get compiled along with all the rest of your code do the following:
- Unload your web app (right click on the project and select ‘Unload Project’)
- Open the csproj file in a text editor (right click on the project and select ‘Edit myProjectName.csproj’)
- At the bottom of the file find the comment which says ‘To modify your build process…’ and insert the following after that comment:
<Target Name="AfterBuild"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" /> </Target>