Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 748
BoltBait Avatar asked Jan 19 '10 01:01

BoltBait


2 Answers

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.

like image 53
BoltBait Avatar answered Sep 29 '22 22:09

BoltBait


I managed to reproduce the error.

Check the properties for the app.config file. The Build Action should be None, not Compile.

like image 30
Guffa Avatar answered Sep 30 '22 00:09

Guffa