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?
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.
I managed to reproduce the error.
Check the properties for the app.config file. The Build Action
should be None
, not Compile
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With