如何返回所有 aspnet_compiler 错误(不仅仅是第一个目录中的错误)
有没有办法让 aspnet_compiler 遍历所有视图并返回所有错误,而不仅仅是当前视图目录中的错误?
例如,假设我有一个包含一堆文件夹的项目...
Views
文件夹1
文件夹2
文件夹3
文件夹4
其中两个(Folder2
和 < code>Folder3) 有错误。 aspnet_compiler 将运行,并且仅返回它在 Folder2
中遇到的错误。它不会同时返回 Folder3
中的内容。一旦我修复了 Folder2
中的错误并再次运行它,它就会拾取 Folder3
中的错误。我修复这些。然后必须再次运行该工具,直到全部修复为止。
这越来越烦人了!!
作为参考,这是我使用的命令:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v / -p "C:\path\to\project"
提前致谢!
Is there a way to get the aspnet_compiler to go through all views and return all errors, rather than just the errors in the current view directory?
For example, lets say I have a project that has a bunch of folders...
Views
Folder1
Folder2
Folder3
Folder4
Two of them (Folder2
and Folder3
) have errors. aspnet_compiler will run, and only return the errors it comes across in Folder2
. It won't return those in Folder3
at the same time. Once I fix the errors in Folder2
and run it again, it'll then pick up the ones in the Folder3
. I fix those. And then have to run the tool again, and again until it's all fixed.
This is getting annoying!!
For reference, here's the command I use:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v / -p "C:\path\to\project"
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
11 年后,我厌倦了自己重新运行
aspnet_compiler
,并想出了一个奇怪的技巧....exe
(或 Linqpad 项目)将aspnet_compiler.exe
加载到您的进程中。AppDomain.FirstChanceException
设置一个事件处理程序,以接收所有HttpCompileException
实例的通知。aspnet_compiler
的Main()
方法捕获,该方法在第一次尝试时失败。HttpCompileException
的文件名保存在HashSet
中。aspnet_compiler
的Main
方法。HttpCompileException
,则您的程序具有失败的文件的名称,因此将该文件添加到-x
编译器排除列表中并重新运行<再次使用 code>aspnet_compiler 的Main
方法。(我仍在整理执行此操作的 Linqpad 程序,我很快会将其发布到此答案)。我想知道@DanAtkinson 是否还能使用它......
11 years later, I grew tired of re-running
aspnet_compiler
myself and came up with one weird trick....exe
(or Linqpad project) that loadsaspnet_compiler.exe
into your process.AppDomain.FirstChanceException
to be notified of allHttpCompileException
instances.aspnet_compiler
'sMain()
method, which fails at the first try.HttpCompileException
in aHashSet
.aspnet_compiler
'sMain
method.HttpCompileException
is thrown, then your program has the name of the file that failed, so then add that file to the-x
compiler exclusion-list and re-runaspnet_compiler
'sMain
method again.(I'm still tidying-up my Linqpad program that does this, I'll post it to this answer shortly). I wonder if @DanAtkinson can still use it...
嗯...您可以让项目构建设置自动为您执行此操作,而不是通过命令提示符执行此操作。在文本编辑器中编辑您的项目文件,并在其中添加此设置(如果尚未添加)...
这应该编译您的所有视图并返回任何编译时错误(如果有)。此外,对于 ASP.NET MVC 项目,您可能需要通过将
MvcBuildViews
属性设置为true
来启用它,因为默认情况下该属性处于禁用状态。希望这有帮助。
Hmmm ... rather than doing this via command prompt you can have your project build settings to do this for you automatically. Edit your project file in a text editor and add this settings in there if not already ...
This should compile all your views and return any compile time errors if any. Additionally for ASP.NET MVC projects, you might want to enable the
MvcBuildViews
property by setting it totrue
as it is disabled by default.Hope this helps.