错误“命名空间不直接包含字段或方法等成员"; [英] Error "A namespace does not directly contain members such as fields or methods"

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

问题描述

我正在尝试构建我的 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".

它到底是如何改变的?我知道我没有改变它.呜呜呜……

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天全站免登陆