Error "A namespace does not directly contain members such as fields or methods"

BoltBait picture BoltBait · Jan 19, 2010 · Viewed 56.3k times · Source

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.

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 is failing me and I'm pulling my hair out. What could be causing this error?

Answer

BoltBait picture BoltBait · Jan 19, 2010

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

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.