VS Project Structure Analysis

Source: Internet
Author: User

When we use VS to develop a project, we should first understand what it means to use vs the IDE to generate some files and folders, what it does, and what the situation is.

Because I'm using VS2015, let's take this as an example to illustrate:

The first thing to do is to change your operating system, the hidden files, folders display, to complete the display vs in the creation of a project when the full file, folder structure.

1. The first thing you see is the. sln file and the hidden. suo file (. vs/your solution name/version/.suo)

NET solution, the. sln file and the. suo file are interpreted as:

when a Web site is created, a solution The file (. sln) and a hidden solution the user options file (. suo) is created. By default, these files is created in the My documents/visual Studio 2005/projects folder. Bcoz They is not required in the deployed website.

SLN (own ' s The following details):

    * A List of the projects that is to be loaded into Visual Studio 2005
    * A List of project Dependencies
    * Microsoft Visual SourceS AFE Information
    * A List of add-ins that is available 

SUO (own ' s the following files) :

    * The Task List
    * Debugger break points and watch window settings
&NB sp;   * Visual Studio window locations 


         visual Studio takes two file types (.sln and so that each time you continue to develop tasks, you will not be distracted by the development environment;

       *.sln: (visual Studio solution )   provides a reference to the location of projects, project items, and solution items on disk by providing the environment Span lang= "en-us", which can be organized into solutions. such as the generation of debug mode release mode cpu is also dedicated

PS: is the index of the open file , correctly guide you into the environment, into the project !


*.suo: (solutionuser options) solution users option records all options that will be associated with the solution.
So that each time you open it, it contains the customizations that you made. For example vs layout , a file that was last compiled by the project and not closed (for next open )

PS: Presumably it is to save some configuration that is not related to the code itself.


*.suo is the format of a file. It's a very important document,

The *.suo solution user option records all options that will be associated with the solution so that each time it is opened, it contains customizations made by the user.

It stores the custom configuration of the user interface, including layouts , breakpoints , and files that were last compiled by the project without closing them (for the next time you open ), so that the next time you open the Visual Studio can restore these settings, so don't delete them, so don't let them .  In fact, the above explanation in English is very clear, to affirm that the PDB does not have breakpoint information .

The VS layout includes a list of variables for monitor 1234, a breakpoint marker and switch status, a distribution of error windows for the Output window, and its suspended state, as well as an item unload status tag.
*.suo files are occasionally destroyed, resulting in unexpected results when building and editing applications. If Visual Studio is not stable for each solution, you should delete the . suo file. The next time you open the solution,Visual Studio rebuilds it.

Summarize:

The sln and suo files together make up the record and configuration of the solution, and the various configurations of the VS solution exist here, each of the details is not listed, the above can give you a whole understanding.
But you need to be clear about the fact that the SLN and the suo are just a detailed project information that records the information about the solution, and in other documents, these two files are just an organizational function that condenses the information together to form a solution that facilitates project development. We do not need to carefully study every detail, but here with this overall understanding, we know that the usual use of VS basic work records are stored in this file.
So, do not arbitrarily delete this you seemingly useless files, delete code will not be lost, but sometimes the environment is configured well, the use is more convenient, for these two files, there is no need to move it. In order to reduce the size of the project file, it is not related to these two files, but if the operation is improper, it will cause the solution to open. Then the solution is to rebuild the project, and then import the code file, it will only waste some time, but also reorganize the project file.
These two files are very basic, small size, but for the organization solution does play a big role, it is recommended not to manually change, in the VS operation will naturally modify the file.

2, next should be a project, Windows is a folder to represent a project.

Form1.cs Form1.Designer.cs Program.cs

1. When you create a Windows forms project, by default, C # Adds a form to the project and names it as Form1. The two files that represent the form are called Form1.cs and Form1.Designer.cs. Your own code is written in Form1.cs, and the Designer.cs file is a file that the C # Windows Forms Designer automatically writes code to implement all the actions that are performed by dragging and dropping controls from the toolbox.

The Designer.cs file contains source code that is written to the form designer when you drag a control to a form, set properties in the Properties window, and so on. In general, you should not edit this file manually at all.

2. One but when you modify the Designer.cs file yourself, or you are learning, copy someone else's Designer.cs file, anyway, as long as your form set value as long as there is little to Designer.cs file, C # will not execute Designer.cs File.

This leads to your hint that InitializeComponent does not exist, but the corresponding Form1.Designer.cs has this method.

The solution is to redo a form and let vs regenerate the Designer.cs file unless you are particularly familiar with the Designer.cs file's relationship to the form.

Form1.cs and Form1.Designer.cs are actually a class, Visual studio in order to let us conveniently manage, with the partial keyword to the form class to take apart, Form1.Designer.cs storage is the layout of the form,
Your form defines which controls, the names of those controls, the properties, and so on, are stored in the Form1.Designer.cs, and Form1.cs is used to store the processing methods,
such as your button click event binding Button_Click This method, it will appear in the Form1.cs
In fact, in earlier versions of Visual Studio, there was no Form1.Designer.cs, and the form's design classes and logic classes were all in one file.
So the benefits are obvious: easy to manage. Allows you to be more intuitive when you are programming.

3.Program.cs is the program entry, which is the main function.

3.. cs. csproj. resx

. cs:c Sharp Source File

Form1.csproj file Everyone should be unfamiliar, that is the C # project file extension, it is "C Sharp project" abbreviation. So who is it for? That's for development tools, such as the one we're familiar with in visual Studio, and the MSBuild.exe that you can never touch, but should have heard about. Visual Studio manages project files and related other kinds of very rich data and operations based on the XML definitions in csproj, and MSBuild also learns from the csproj file which dependencies, default output paths, are required to compile the project. What actions are required for pre-build and post-build, and so on. Both Visual Studio and MSBuild are development tools, which is the only meaning that csproj exists: providing information for the development environment. And in the running environment, no one at all (operating system? Care about the so-called csproj file-the "where the program comes from".

Form1.resx: (Form resource file) the resources that you embed when you design a form to hold your form resources, such as when you customize your form's icon, the icon appears in the Form.resx .

VS Project Structure Analysis

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.