How to get expansion of code behind files in a vb.net web app?
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?
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."
What happens if you click on the file and press F7 (View Code)?
Based on Microsoft's response shown above, why does Visual Web Developer 2010 show the code behind file in the project explorer for VB .net projects ?
Is the implication that those who use the 'cut down' version of Visual Studio to construct VB .net projects are more sophisticated in their understanding of such advanced concepts ?
精彩评论