Is there any way to limit the view building to only files included in the .csproj file? Or is there at least a way to exclude certain folders from being built?
In our project folder structure we have an \Admin\Mocks folder which contains lots of mocked up .aspx and .cshtml files, and while the \Admin\Mocks folder isn't included in the .csproj file (though \Admin is), it seems that all the files in that tree are getting built. This of course generates LOTS of build errors.
I'm not sure that this makes a difference, but our project is a hybrid WebForms/Mvc3 application (both WebForms and Razor View Engines) using Asp.Net 4.
Based on the time stamp I assume you eventually worked around this but I got here Googling for a solution to the same problem.
We have a bunch of old Webforms views that are only checked in (not referenced by the project) for reference purposes and for A/B testing while we are updating the application. (Webforms -> Razor, MVC2 -> MVC4, etc)
This was an issue as both the .cshtml and .aspx files were being built and the errors from the Webform views were breaking the build.
The solution for us was to rename the the old view files from Index.aspx to Index.aspx.old
(In your case I would suggest Index.aspx.mock ?)
This meant they were excluded from the MvcBuildViews = True processing, but were still easily accessible and able to be opened from Visual Studio.
The additional benefit is you can change the default open with for that extension to use the Webforms editor so you still get highlighting and all.
If possible, create a separate web project and put the content you don't want to be built in there, making sure to set MVCBuildViews to false.
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