I'm a C# guy, but I need to work on a vb.net application.
In a C# web app, you can expand the codebehind and designer files by clicking on the little arrow to the left of the .aspx file name.
However, I don't see that in the vb.net project. Instead I have to open the aspx, then hit F7 to get to the code behind.
How can I tell studio to show me the codebehind files in the project explorer? .. other than picking Show All Files which also lists things that are not part of my project?
Right-click the . aspx page, and then click View Code. The code-behind file opens in the editor.
Apparently, there is no way to do this for vb.net projects other than to set the solution explorer to Show All Files.
I filed a change request on Microsoft Connect at https://connect.microsoft.com/VisualStudio/feedback/details/590046/show-related-code-behind-files-for-vb-net-web-applications-in-solution-explorer
An interesting response was:
This is standard behavior for all VB projects, and is in keeping with the VB team's general philosophy that their users are not sophisticated enough to understand advanced concepts like related files in a nested hierarchy.
(emphasis added). Further comments after that are probably not necessary.
I know this is a bit of an old question, but it's one of the top results on Google and I found an alternate solution.
Open your .vbproj file for the project in a text editor, and search for your codebehind file's name. You'll find that it looks something like this:
<Compile Include="dashboard\index.aspx.vb">
<DependentUpon>index.aspx</DependentUpon>
<SubType>ASPXCodebehind</SubType>
</Compile>
If you simply remove the DependentUpon
tag, everything will still work properly, but both files will show up in Visual Studio, as desired. So my final version would look like this:
<Compile Include="dashboard\index.aspx.vb">
<SubType>ASPXCodeBehind</SubType>
</Compile>
It takes a little bit of manual editing but it works for me. Alternatively if you manually rename/edit your files into a page/codebehind format after creating regular class files, they will appear as wanted in the project without having to resort to "Show All Files."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With