立即窗口,“无法评估表达式...." [英] Immediate Window, "The expression cannot be evaluated...."

查看:18
本文介绍了立即窗口,“无法评估表达式...."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在设计时尝试评估即时窗口中的表达式时,我收到错误:

When I try to evaluate expression in Immediate Window at design time, I get error:

在设计模式下无法计算表达式.

The expression cannot be evaluated while in design mode.

如果我编译 ASP.NET 项目并尝试在调试模式下运行它,我会收到另一个错误:

If I compile ASP.NET project and try to run it in debug mode I get another error:

在运行模式下无法计算表达式.

The expression cannot be evaluated while in run mode.

为什么会出现这些错误?我过去使用过即时窗口,即使在设计模式下也能正常工作.

Why do I get these errors? I have used Immediate Window in the past and it worked fine even in design mode.

推荐答案

假设您没有错过即时窗口中的 > 运算符,如果您尝试评估可能会出现问题多项目解决方案甚至网络项目中的设计时表达式.

Assuming that you aren't missing the > operator in the Immediate Window, there could be problems if you are trying to evaluate an expression at design-time in a multi-project solution or even a web project.

根据 MSDN:

如果您尝试评估项目中的函数,但解决方案的启动项目,您收到错误,请尝试在解决方案资源管理器中选择项目并尝试评估再次.

If you are attempting to evaluate a function in a project that is not the startup project for the solution and you receive an error, try selecting the project in Solution Explorer and attempt the evaluation again.

还有:

您不能在项目类型中使用设计时表达式评估需要启动执行环境,包括 Visual Studio适用于 Office 项目、Web 项目、智能设备项目和SQL 项目.

You cannot use design time expression evaluation in project types that require starting up an execution environment, including Visual Studio Tools for Office projects, Web projects, Smart Device projects, and SQL projects.

这篇关于立即窗口,“无法评估表达式...."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆