Visual Studio 2010 - 仅针对活动文件显示警告
我希望您能帮助我解决 Visual Studio 2010 中的问题。
通常在 Visual Studio 2008 中,当我编译项目时,会显示所有文件的警告。但在 Visual Studio 2010 中并非如此。当我编译项目时,直到文件处于活动状态才会显示警告,然后错误列表中仅显示活动文件的警告。
我最近发现了一些新的东西:问题似乎只出现在 ASP.NET 页面(.master、.aspx)中,而不出现在隐藏代码文件(.master.cs、.aspx.cs)中。与 ASP.NET 页面(后台代码文件除外)相关的警告是否存在问题?
提前致谢。
此致, 赫曼新
i hope you can help me with my problem in Visual Studio 2010.
Normally in Visual Studio 2008, when i compile a project warnings for all files are shown. But not so in Visual Studio 2010. When i compile a project warnings are shown not until a file is active and then only warnings for the active file are shown in error list.
And I have recently found out something new: the problem only seems to be in ASP.NET Pages (.master, .aspx), but not in Behind-Code-Files (.master.cs, .aspx.cs). Is there a problem with warnings in relation with ASP.NET Pages (except the behind-code-files)?
Thanks in advance.
Best Regards,
HeManNew
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Visual Studio 2008 和 2010 在列出页面错误和警告时实际上表现相同。
当页面的编辑器打开(无论它是否是活动窗口)或出现错误(不是警告或消息)时,页面的错误和警告会出现在错误列表中)阻止应用程序编译。但由于标记页未编译,因此只有服务器端错误会阻止应用程序编译。
因此,总而言之,Visual Studio 运行正常。要查看标记页面特有的错误和警告,您需要先打开它。编译与标记错误无关。
Visual Studio 2008 and 2010 actually behave the same when listing errors and warnings for pages.
A page's errors and warnings appear in the Error List when its editor is open (regardless of whether it's the active window) or when the errors (not warnings or messages) prevent the application from compiling. But because markup pages are not compiled, only server-side errors prevent the application from compiling.
So, in sum, Visual Studio is behaving correctly. To see the errors and warnings particular to a markup page, you need to open it first. Compiling has nothing to do with markup errors.
我知道自 VS2005 以来所描述的行为(我对早期版本没有经验)。
.aspx
在运行时(或在 VS 2010 中打开时)进行编译。因此,在页面运行时会发现错误(和警告)。您甚至可以编辑.aspx
并在重新加载页面时使用新版本(加载时间相当长)。我不知道有什么方法可以让iis编译所有aspx。
但也许我们会遇到一种不同的行为,因为我看到所有打开的 .aspx 文件的警告,而不仅仅是活动文件的警告。
I know described behavior since VS2005 (I have no experience with earlier versions).
The
.aspx
is compiled at runtime (or when it is opened in VS 2010). So errors (and warnings) are found when page is run. You can even edit.aspx
and new version is used when page is reloaded (the load time is considerably longer).I don't know any way to say to iis to compile all aspx.
But maybe we experience a different behavior because I see warnings for all opened
.aspx
files, not only for the active one.