3

The problem that i have is that when i open the solution that i am working on, in some files it will not recognize a namespace even thought that namespace is part of the same project and the solution builds fine. I could get rid of this problem by deleting my .suo file in the solution root folder but it is getting annoying to delete the .suo file every time i load the solution, plus i like the options that visual studio remembers the documents that i had opened when i closed the solution. I have heard that this may be caused by an extension but i disabled all the extensions and it still happens.

I am using visual studio ultimate 2013. I am working on a big solution that is connected with tfs and many peoples are working on it.

Does anybody have any idea why this is happening?

ZuZu
  • 94
  • 1
  • 9
  • Could you possibly add some screenshots? – Hugh Jun 30 '15 at 10:09
  • @Hughnited I'm sorry but the code is confidential but basically the problem is the same as when you add a using directive without adding it to the reference but in this case the reference is to something in the same solution. And the strangest thing is that the error display only when i open the documents that have this using. If i don't open this documents the solution builds without displaying any error at all. And the error displayed is the typical "The type or namespace name 'namespace name' could not be found (are you missing a using directive or an assembly reference?)" – ZuZu Jun 30 '15 at 10:22
  • I suppose you have already tried clean and rebuild the solution or restart visual studio? Also, are you the only one in your team experiencing this? – Hugh Jun 30 '15 at 10:30
  • @Hughnited Yes i have tried everything. Rebuilding and restarting doesn't help but removing the project from the solution and adding it again helps but only until i close the solution. As far as i know i am the only one experiencing this. – ZuZu Jun 30 '15 at 10:34
  • Have a look at the following link: http://stackoverflow.com/questions/3304741/getting-type-or-namespace-name-could-not-be-found-but-everything-seems-ok – Hugh Jun 30 '15 at 10:54
  • https://stackoverflow.com/questions/4228992/namespace-not-recognized-even-though-it-is-there – Thaun_ Nov 13 '17 at 18:04
  • Possible duplicate of [Namespace not recognized (even though it is there)](https://stackoverflow.com/questions/4228992/namespace-not-recognized-even-though-it-is-there) – Thaun_ Nov 13 '17 at 18:04

2 Answers2

3

This question is old and I'm on a newer version of Visual Studio (2017), but having the same problem and my Google search led me to this question.

The solution to this in VS 2017 seems to be to delete the .vs folder that's in the same folder as the solution file. It's hidden, so you'll have to either show hidden files to see it or open a command prompt in that location and run the command

attrib -h .vs

dwilliss
  • 862
  • 7
  • 19
0

Sometimes, if you have this problem and need a quick workaround, you can build .dll and reference that in project.

T.Todua
  • 53,146
  • 19
  • 236
  • 237