views:

328

answers:

4

I can't seem to find any of my code behind files in the class view tab. I can see other classes that I have added but none of the code behind files. Is there a reason for this? I am missing a setting or something? It is quite irritating trying to navigate my way through the code all the time.

I can see all the other classes just fine just not my code behind files.

+1  A: 

Don't be placing classes other than the class backing the page in code-behind. Place all other code in a separate library project or at the very least in the App_Code folder.

AnthonyWJones
I'd go further: don't use Website projects :)
Mehrdad Afshari
+6  A: 

Class View is intended to provide a hierarchical view of the "symbols" defined in your project. For website projects, it will only list the referenced assemblies and any classes defined in App_code.

So, no, you aren't missing a setting. You're missing the point of the Class View window ! ;-) Maybe you should be looking in the Solution Explorer instead.

BTW, if you're having trouble navigating through code files, you should consider better organizing your files (in folders, for instance).

Edit (after a Bounty has been placed on this question... drool! ) :


Okay, I have VS 2005 SP1. I tried the following cases:

a. Create New Website (VB or C#):

The Class View window is blank until you add an App_Code folder. When added, the Class View window displays any classes added to the App_Code folder and the default Project references (System, System.Web, etc). It does not however display any Page code-behind classes.

b. Create New Project -> Web -> ASP.NET WebApplication:

The Class View window auto-populates with the Project references and the Page code-behind classes. This happens before I added any folder containing class files.

I am not sure if you are familiar with the ASP.NET Web Application Projects. If not, you need to have the Service Pack for VS 2005 installed. You can get it here. Else, you can also install the Web Application Projects extension directly.

Cerebrus
I can see the classes, I just can't see their outline. I want to see a summary of the methods and variables in that class. Maybe that is what I should have said. Where is the class outline view???
uriDium
+1  A: 

There should be a drop down menu right above the code. The left on is the classes in your open file and the right are members of the selected class.

A great way to navigate code in Visual Studio is with the right-click context menu's Go to Definition and Go to Declaration options.

You could also use Reflector on your assemblies to view the class/member hierarchy in a tree.

scottm
Hi. I found what you are talking about but that is rather irritating that I have to click a drop down. Is there no view that will display a complete list of variables and methods and clicking on it will take you to the place in the code. Similar to Eclipse's class outline view?
uriDium
uriDium, I think you'll find what you are looking for with Reflector (it's free).
scottm
A: 

VS 2008 improves the class view to what you want ... just saying.

Edit: Nevermind, VS2005 should do what you want as well. You can use the Object Browser as well.

Richard Hein