Pages

Search This Blog

Thursday, April 10, 2008

CS0101: The namespace '<global namespace>' already contains a definition for 'xxxxx'

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0101: The namespace '<global namespace>' already contains a definition for 'xxxx'




check whether you have a copy of the file with different name but using the same class (duplicate file). In My case, i have a backup copy for a aspx file. Delete the file or exclude from the project will solve the problem.

8 comments:

Ravi said...

Hi, I am getting the same problem but in my case the pages works fine in some servers but fails in some other servers.
Any help would be appreciated

In blues said...

Hi Ravi,
Have you solve your problem? I think i need more information on your problem. Please let me know. Thanks

Anonymous said...

this was great, first hit on google and it told me exactly what I needed to do, how silly of me to not realize that the backup copy I made of my proxy file was causing this error!

Thanks a lot for posting this, you saved me a lot of headache.

Anonymous said...

Thanks, this solved my problem straight away. I had accidentally FTP'd files to the wrong dir!!!

Anonymous said...

I recently had the same problem when i renamed a web service. You can easily find the location where classes are defined by right clicking on the class name then selecting 'Go to definition'. If the class is defined in more than one place (and therfore causing this error) then all places where the class is defined is listed in the results window.

Anonymous said...

And there is what some alternative?

Anonymous said...

thanks.you are a life saver

Chris said...

I got this problem when I renamed a source file and then deployed to the server. Since my deployment is a simple FTP, it left the original file in place, causing the duplicate. Of course, it worked on my local copy where the file was properly renamed. Thanks for the help in tracking down.