A namespace does not directly contain members such as fields or methods May 15, 2007
Posted by frater in All, Software Development.trackback
A namespace does not directly contain members such as fields or methods – another interesting and completely unhelpful error message courtesy of .Net. Thankyou for flying
This particular error caused me a great deal of problem in a piece of software I had designed and written that used Web Services Enhancements (WSE) 2.0 SP3, using Visual Studio .Net 2003. There wasn’t a lot of information around but I eventually solved the problem – actually, it was quite simple.
As anyone using web services enhancements knows, you right click the project name, choose “Web Service Enhancements” and check the little check box to enable WSE for your project. This adds an app.config to your program if you dont already have one with a little configuration information designed to make WSE work for you.
Turns out if your app.config gets invalid somehow, that can cause this error to occur. I had two things in my app config, both managed by the designer – the wse settings and a dynamic web service link. The fix was simple, I set the web service link back to static (to remove its dependancy on the app.config) and disabled wse 2.0. Then I hit compile. It wont compile of course, without the WSE addons it needs, but I figure it’d ensure that the changes I made had propogated. I then deleted the app.config file altogether and re-enabled wse 2.0.
This creates a new app.config with the appropriate settings, and whatever was corrupted about my old one was now corrected. All I had to do then was reset my web service link to dynamic, update the reference and hit recompile and it worked like a charm.
So just remember a possible reason for this error can be a corrupted app.config. Regenerate it (or re-write it if you manually wrote the file) and it can vanish nice and easy.
Thanks! I saw the same problem today & was able to correct it simply by deleting my old AppConfig and creating a new one.