I know this is 2 years old but recently I stumbled on the same problem, but since I needed the view for both MVC and e-mail I couldn't simply change the extension of the file.
Searching for solutions I found this documentation on aspnet_compiler
and the -u
options, that stands for Updatable, which keeps the original file intact after compilation.
In order to achieve the desired behavior I configured my publish profile as follow:
- On Settings tab of Publish dialog expand the File Publish Options and check Precompile during publishing.
- Click the Configure link after the checkbox and check Allow precompiled site to be updatable
Caution
Before jumping in this solution you should read carefully about the implications of this option. In the link I provided there is a Precompilation Decision Matrix to help on your decision.