当前位置:网站首页>[Tutorial] Share and reuse project properties in visual studio

[Tutorial] Share and reuse project properties in visual studio

2022-09-23 08:50:41real_metrix

Environment

  1. os:windows 10
  2. IDE: visual studio 2015

Foreword

When developing a project under visual studio, the properties of the project are usually configured, such as importing external header files, importing external libraries, etc.
insert image description here
Especially the different development modes, debug and release, different development platforms,x64 and x86, etc., the configured items are not shared.This means that every time you switch to a different development mode and platform, or every time you start a new project (but the project properties are the same), you have to manually configure these properties, which is obviously unreasonable.

In fact, visual studio provides a way to share and reuse project properties, let's take a look.

Share of different development modes and platforms in the same project

This setting is relatively simple, we only need to set both Configuration and Platform to All ..., as shown below
insert image description here
so that when you set project properties, debug and release, x64 and x86 etc all share the same configuration properties.

Share and reuse project properties across projects

Many times, when developing projects in a company, everyone will use a unified configuration environment for project properties, including the same development platform, the same toolset, the same external header files, import libraries, etc.It is configured from scratch during development.

Visual studio uses the Property Manager to create new project properties, or to import external project properties.Let's take a look at the specific steps below.

Click [View]-[Other Windows]-[Property Manager] in the following order, and then the column ④ will appear, we can see that it lists different development modes and different platforms one by one
Insert image description here
Select the project configuration properties of the corresponding development mode and platform you need to import, for example, here I give an example "Debug | x64"

Right-click as shown in the figure, you can choose to create a new project property, or you can import an existing project property. If you are importing an existing project property, you can click to find the corresponding project property sheet, which starts with

code>.props end.You can also create new project property sheets for use by other projects.
insert image description here
After introducing the new project properties, you can view it againCorresponding to the project properties of the development mode and platform, it is found that it has been applied.

Advanced

The use of project property sheets is very flexible. A project can set multiple project property sheets. Visual studio determines the coverage of the same property in different property sheets according to the arrangement order. The principle is that later properties will override previous properties.

Introducing a common project property sheet does not affect your setting of the current project's independent project properties. In fact, if you set your own project properties in the property configuration page, its priority is the highest.

[Note] The property configuration page is the page displayed at the beginning of the article

Reference

  1. Share or reuse Visual Studio project settings
  2. a>
  3. File Types in Visual Studio (sln vcproj suo user ncb)
原网站

版权声明
本文为[real_metrix]所创,转载请带上原文链接,感谢
https://chowdera.com/2022/266/202209230844240675.html

随机推荐