如何解决"xxx在当前上下文中不存在". [英] How to solve "xxx does not exist in the current context"

查看:259
本文介绍了如何解决"xxx在当前上下文中不存在".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从" http ://code.google.com/p/nighthawk/source/browse/#svn%2Ftrunk%2FNighthawk [
[点击此处获取屏幕截图]

错误 2 '数据位于的根级别无效.第 1 行,位置 2 . XML 无效有效.

错误 4 类型名称空间名称'Application'可能 被发现(您是否缺少使用指令程序集引用?)

错误 5 类型名称空间名称'StartupEventArgs'可能 被发现(您是否缺少使用指令程序集引用?)

错误 6 名称'NBug'在当前上下文中存在

知道所有这些有什么问题吗?我该怎么做才能解决这个问题?

谢谢

解决方案

您需要在自己的项目中添加对NBug.dll的引用(右键单击References-> Add Reference ...- >浏览并在此处找到它.)


从根本上讲,它与名称空间有关.我的想法是将NBug类编译成单个DLL,然后由您的应用程序引用.

尝试以下操作:将编辑点放在单词"NBug"内,并且在"N"下会出现一条小的蓝线.
将鼠标悬停在蓝线上,将会显示一个下拉列表.
打开下拉列表,您将看到该问题的解决方案.
选择第一个-它应该添加一个适当的using语句,并且应该进行编译.


通过在Source Control应用程序的帮助下导入源文件来成功运行该解决方案.

I encounter this problem when i manually download a project sample source code from " http://code.google.com/p/nighthawk/source/browse/#svn%2Ftrunk%2FNighthawk[^]


[Click here fore screenshot ]

Error   2   'Data at the root level is invalid. Line 1, position 2.' XML is not valid.  

Error   4   The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?)  

Error   5   The type or namespace name 'StartupEventArgs' could not be found (are you missing a using directive or an assembly reference?) 

Error   6   The name 'NBug' does not exist in the current context  

Any idea whats wrong with all these? What shall i do to solve this?

Thanks

解决方案

You need to add a reference to the NBug.dll in your own project (right click References->Add Reference...->Browse and find it there).


In basic terms, it''s to do with the namespace. I think the idea was that the NBug classes would be compiled into a single DLL and then referenced by your application.

Try this: put the edit point inside the word "NBug" and a small blue line will appera under the "N".
Hover the mouse over the blue line, and a drop down list will appear.
Open the drop down, and you will be presented with solutions to the problem.
Select the first one - it should add an appropriate using statement, and it should compile.


Successfully run the solution by import the source file with the help of Source Control application


这篇关于如何解决"xxx在当前上下文中不存在".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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