Visual Studio is not recognizing new classes

Viewed 31216

I'm using visual studio 2008 SP1, I'm working with a web project in VB.NET. the problem when I add new class file (of-course in App_Code) it doesn't recognize it. all the old class files are working fine, but the new ones aren't. I restarted my computer and still the same problem.

Any Ideas

6 Answers

A made a small checklist bases on answer (also what I would do)

  1. Access modifier of a class must be Public or Friend. Read more here
Public Class MyClass

End Class
  1. Namespace The class you are trying to access to must be either in the same namespace or Imported via the keyword Imports YourNamespace.MyFeature Read more here

  2. A vb class must be set to compile in its build action. The option wont be available if your are in debug / running mode. To check this you need to: Right click on MyClass.vb -> Property -> Build Action -> Compile.

  3. If these steps didn't work you could try to clean project/solution, close and reopen VS, then re-build project/solution.

Hope it help!

Sometimes, a simple Clean and Rebuild of the project will resolve the issue.

I was refactoring a non-object-oriented C++ code to an object-oriented one. So, I think Visual Studio was confused at that point and the solution I mentioned worked for me.

Related