[Visual Studio] the parent-child relationship between custom files and files in solution Manager

Source: Internet
Author: User

When using Visual Studio to develop software projects, you can easily manage program code and related resources through the solution manager provided by Visual Studio. The program code files of each software project in the solution manager are displayed in a tree structure. The tree structure mainly serves as a reference for rendering based on the object directory path and object file path.

 

 

With the evolution of the times, simply following the object directory path and object file path as a reference for tree structure presentation has gradually kept up with development requirements. For example, an ASP. NET web page in a software project contains three program code files:. aspx,. CS, And. Designer. CS. In this case, if the scheme manager simply follows the rules listed above, it can be expected that ASP. as the number of web pages increases, the solution manager is overwhelmed by the list of program code files, which affects the efficiency of developers in searching for program code files.

 

 

To facilitate program code and related resources, Visual Studio's solution manager adds the function of defining the parent-child relationship between files in the project file (. csproj) of a software project. With this function, the solution manager can use the definition of the parent-child relationship as a reference when presenting the program code file in a tree structure, it is used to enhance the ability to store and classify program code files, and thus improve the efficiency of developers in searching for program code files.

 

For example, the following example is an ASP.. NET application project file content. This section mainly defines that the project contains three files: webform1.aspx and webform1.aspx. CS, webform1.aspx. designer. CS, where webform1.aspx. CS, webform1.aspx. designer. CS files depend on webform1.aspx. In other words, webform1.aspx is the parent file of the other two program code files. The project file contains the definition of the parent-child relationship. The presentation on the solution manager will include two files:. CS and. Designer. CS under the webform1.aspx file that developers are familiar.

 

<ItemGroup>  <Content Include="WebForm1.aspx" /></ItemGroup><ItemGroup>  <Compile Include="WebForm1.aspx.cs">    <DependentUpon>WebForm1.aspx</DependentUpon>  </Compile>  <Compile Include="WebForm1.aspx.designer.cs">    <DependentUpon>WebForm1.aspx</DependentUpon>  </Compile></ItemGroup>

 

 

In the native state, Visual Studio ide does not provide the function of editing the parent-child relationship between files and files. When a developer joins a new project to a software project, they can only use the predefined parent-child relationship definition. For example, if you add a new WPF window to a WPF software project, IDE adds the. XAML and. CS program code files and defines. XAML as the parent file of. CS.

 

If you need to customize the parent-child relationship between the file and the file, you can use NotePad to open the project file (. csproj) for modification, but this method is easy to correct, and very unfriendly, it is not recommended for developers to adopt this solution. We recommend that you install the extension suite, for example, "vscommands for Visual Studio 2012". This suite provides Visual Studio with many features, one of which is: allows you to edit the parent-child relationship between an archive and an archive.

The following example describes how to edit the parent-child relationship between an archive and an archive through the functions provided by the "vscommands for Visual Studio 2012" suite.

 

1. The example is an ASP. NET application. In this software project, it contains a webform and CSS file dedicated to this webform.

 

 

2. In the Visual Studio tutorial, choose webform1.aspx1_webform1.aspx.css and right-click the file. If "vscommands for Visual Studio 2012" is installed, you can view the group items option in the menu and click this option.

 

 

3. Then, Vs will provide a dialog box listing the selected files in the previous step and asking the developer to select the parent file (the remaining files are sub-files ). Select webform1.aspx and press OK.

 

 

4.edit the parent-child relationship between webform1.aspx?webform1.aspx.css and webform1.aspx.css. In the project manager, we can see that webform1.aspx.css has been classified under webform1.aspx and can be hidden to make the entire project more fresh.

 

 

 

At the end of this article, let's take a look at the best gallery | demo shop created by the Buddha's heart. This website introduces many practical Visual Studio suites, many of which make development easier and more efficient, do not miss out on developers who use vs2010 and vs2012 as livelihood tools. : D

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.