asp.net mvc compile views [duplicate]
Possible Duplicate:
Compile Views in ASP.NET MVC
Is there any way I can get early info about errors in my view. It is little too slow to find out what is happening only after I've loaded page in browser. And if I do it with ajax....oh boy :( Should I write some kind of integration tests for fetching my controllers and checking for response? What is your approach for faster development in asp.net mvc?
Than开发者_运维知识库x ;)
You can use a post-build task to compile views. See this answer.
Just an FYI, if you want to be able to see errors when doing ajax posts; most modern browsers will let you visualize requests and responses.
For Firefox you can download Firebug and look at the NET tab.
In Chrome you can open the developer tools by pressing ctrl+shift+i and then click the network tab
In IE you can press F12 to bring up developer tools.
Resharper will tell you about errors in your views before you hit build
EDIT: And might I say, it also offers many other useful features for MVC development such as recognising view names inside strings.
Keep in mind that if you enable the compile view... your solution can take a long time to compile. You can activate it only to release mode and switch between release/debug depending if you want to compile your views or not.
- Open your .csproject or .vbproject file in a text editor of your choice. It’s just a simple xml file, which is why any editor will do fine.
- Locate the <PropertyGroup> element that belongs to the configuration you would like to alter.
- Within this PropertyGroup, add an additional element with “true” as its text value.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<MvcBuildViews>true</MvcBuildViews>
精彩评论