Visual Studio-C + + Engineering file interpretation

Source: Internet
Author: User

In VS2010, the project file of C + + has been very different from 2005/2008, but it is expressed entirely in MSBUILD's attribute mode, and it allows the user to customize all the properties through a one-time configuration.

According to my understanding and the actual use of some of the information found, is now compiled to share with you:

First, the project document is divided into three main parts: initialization configuration information, default configuration information and local configuration information;

The configuration information is all organized by the attribute file, and can be referenced by "import";

The properties file can contain the configuration of Project properties, compilation properties and link properties;

All configuration items can be used to determine whether the configuration takes effect by using filter conditions;

The registry or call can be accessed through the built-in expression. NET function;

First of all, the composition of the engineering documents

1, the initial part of the project document is Projectconfigurations, which contains the configuration (Debug or Release) and Platform (WIN32, x64, etc.), this section is configured with the number of project compilation targets, The default configuration is only two: Debug and Release under the Win32 platform;

2, followed by the configuration of all global properties, the key is the Keyword property, which determines a lot of subsequent default properties file import behavior, such as whether to import MFC default property settings;

3. Import the C + + default properties file Microsoft.Cpp.Default.props, which is under C:\Program files (x86) \msbuild\microsoft.cpp\v4.0 directory (default security on Windows 64 Location, may be different on your machine, can be found in the registry hkey_local_machine\software\microsoft\msbuild\toolsversions\4.0 properties Vctargetspath) ;

4, according to the configuration of the compilation of some of the specific configuration of the project, such as "ConfigurationType", "CharacterSet" and "WholeProgramOptimization"

5, Import C + + properties file Microsoft.Cpp.props, and the default property file Microsoft.Cpp.Default.props in the same location

6, according to the compilation configuration different import different User Configuration properties file, mainly based on the platform of different properties file import, path is%localappdata%\microsoft\msbuild\v4.0\, these files are not configured any content, if you delete them, The IDE automatically creates them when you open a C + + project file, and it's important to note that the purpose of these files is to customize the properties of C + + projects and to be user-level, which means that the attributes added to these files will work for all of your projects. ;

7, according to the compilation of the configuration of the "compile", "Connection", "library" and other options for the project's local configuration, such as: "Warning Level", "Optimization Options" and "macro" definition, etc.;

8, the project contains the files, for example, Clcompile contains the need to be compiled by C + + files, Resourcecompile contains the need to compile the RC resource files, and so on;

9, Import C + + compiler target attribute definition file "Microsoft.Cpp.targets", and the default property file location is the same;

Well, so far, the 9 components of the engineering document have been roughly analyzed, if the Microsoft.Cpp.Default.props, Microsoft.Cpp.props and Microsoft.Cpp.targets For simple analysis, they are all the first to import the corresponding platform-defined files based on the target platform of the compilation, and then their own property definitions, and these properties will not be defined to take effect, avoid flushing the previous definition, and can also find a secret, That is, in the compilation system also provides a free property for each project will be to file, *.vcxproj.user, if this file exists, then it will be automatically imported;

From the above analysis, we can find that the C + + compiler system in fact, in addition to the project file itself (after all, it is impossible to put all the compilation options in the project file) also provides three levels of the property configuration file:

1, the project level, is the *.vcxproj.user file;

2, the user level, is microsoft.cpp.$ (Platform). user.props file

3, the system level, is provided to Microsoft.Cpp.Default.props, Microsoft.Cpp.props and Microsoft.Cpp.targets files;

Visual Studio-C + + Engineering file interpretation

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.