开发者

Show missing PartialView as a build error

开发者 https://www.devze.com 2023-01-09 18:17 出处:网络
I\'ve been reorganising our views at work and moving them around to more appropriate locations. Because we\'re currently organising many of our views into their own folders within the Views folder, w

I've been reorganising our views at work and moving them around to more appropriate locations.

Because we're currently organising many of our views into their own folders within the Views folder, we're having to reference our views using the full path in RenderView.

Is there a way that I开发者_如何学JAVA can get Visual Studio to throw a build error if the location of the ascx file that the RenderPartial method points to doesn't exist?

There is an error shown at run time however I'd like it to be part of the build process.

Thanks for any advice


View locations are resolved only at runtime so I really don't see how this could be done, unless you write some custom step in MSBuild that will analyze the source code and check the existence of corresponding view files but this will be a challenging task.


MvcBuildViews might help with this:

Compile Views in ASP.NET MVC

0

精彩评论

暂无评论...
验证码 换一张
取 消