Error CS0117: NamespaceOuter does not contain a definition for NamespaceInner or The namespace in dll conflicts with the type in dll
In the last post regarding error will see how to resolve issue of Error Message: The property is part of the object's key information and cannot be modified
Sometimes we receive above error when trying to run our web site but does not show any error on the build and show build success. It is a strange situation when your solution builds successfully but show error when try to run the website and if you try to see namespace name in intelligence than we can see the name of the namespace.
If we see in error message then we can see “The namespace in dll conflicts with the type in ddl” that bold letters show that there are two objects with the same name in our solution, one is namespace and other is a type(type could be class name, structure or any other dotnet type).
Suppose if you have a dll with name SBR.Data.DataAccessor class where SBR.Data is the name of namespace. Now you add this ddl in you your web site then you can use SBR.Data namespace to access DataAccessor class. If you add a page with name SBR.aspx in your solution then it will create a class with name SBR for that page. Now your website is having one namespace with name SBR and one class with name SBR.
When you try to access SBR.Data namespace than it will show error. “ error CS0117: SBR does not contain a definition for Data” because when we try to run our site than SBR class got higher priority than namespace SBR so compile think that we are trying to access Data(SBR.Data) namespace from SBR class and through error.
To see actual cause of error follow below steps.
1. Close your visual studio and start it again.
2. Now don't built solution. Press F5.
3. If your application has any other compilation error it will show that first so remove that errors first.
Now see on which page it shows “error CS0117: NamespaceOuter does not contain a definition for NamespaceInner” error. The conflicted class will be on the same level on the website. i.e. the page is on root level than page having conflicted class will also on root level so search for that class and rename it.