错误“名称空间不直接包含诸如字段或方法之类的成员". [英] Error "A namespace does not directly contain members such as fields or methods"

查看:127
本文介绍了错误“名称空间不直接包含诸如字段或方法之类的成员".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建C#项目,并且收到错误消息名称空间不直接包含诸如字段或方法之类的成员".它标记了app.config文件的第一个字符(小于符号).

I'm trying to build my C# project and I'm getting the error message "A namespace does not directly contain members such as fields or methods". It is flagging the first character (the less than symbol) of the app.config file.

我已经检查了所有文件中是否有在名称空间内直接存在变量或函数的地方-什么也没找到. app.config看起来不错.

I've checked all of my files for places where there are variables or functions directly inside of a namespace--found nothing. The app.config looks fine.

Google让我失望了,我正在拔头发.是什么原因导致此错误?

Google is failing me and I'm pulling my hair out. What could be causing this error?

推荐答案

数字!一旦我终于崩溃了,问了一个我找到答案的问题...

Figures! As soon as I finally break down and ask the question that I find the answer...

app.config文件属性部分(以某种方式)列出了应将编译"设置为无"时的生成操作".

The app.config file properties section (somehow) listed the Build Action of "Compile" when it should be set to "None".

世界上它是如何改变的?我知道我没有改变. rr ...

How in the world did it get changed? I know I didn't change it. Grrr...

哦,至少现在正在建造.希望其他人将从我的脱发中受益.

Oh well, at least it's building now. Hopefully someone else will benefit from my hairloss.

这篇关于错误“名称空间不直接包含诸如字段或方法之类的成员".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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