VS 's Project property sheet is actually defined by a series of XML files that are stored in C:\Program files (x86) \msbuild\microsoft.cpp\v4.0\v110\2052 directory, we can simply add our own property pages in the same context as their definitions.
First, import the custom target in the project file:
<import condition= "$ (Platform) = = ' hi3516 '" project= "Embedlinux.targets"/>
The embedlinux.targets here is the file you created, with a reference to the XML file in this target file:
<itemgroup condition =" "$ (usedefaultpropertypageschemas) '! = ' False '
<propertypageschemaCondition= "' $ (configurationtype) '! = ' Utility ' " Include="2052\gnu.xml"/>
</ItemGroup>
All of our configuration definitions are stored in the gnu.xml file.
<? XML version =" 1.0 " encoding =" Utf-8 "?>
<!-- Copyright, Microsoft Corporation, All rights reserved. -
<RuleName="Gnu"pagetemplate="Tool"DisplayName="GNUConfiguration"Switchprefix="/"Order=" -"xmlns="http://schemas.microsoft.com/build/2009/properties"xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"Xmlns:sys="Clr-namespace:system;assembly=mscorlib">
<rule.categories>
<CategoryName= "General"DisplayName= " project "/>
</rule.categories>
<rule.datasource >
<datasource persistence =" projectfile " label =" configuration " hasconfigurationcondition =" true "/>
</rule.datasource>
<EnumPropertyName="Gnuprojecttype"DisplayName="GNUProject Type"Description="SelectGNUtype to which the project belongs"Category=" General">
<enumvalue name =" uboot " displayname =" uboot " description =" uboot project.
</enumvalue>
<EnumvalueName="Linuxkernel"DisplayName="LinuxKernel"Description="this is aLinuxKernel project. ">
</enumvalue>
<EnumvalueName="Linuxmakeapp"DisplayName="LinuxApplications (Makefile)"Description="This is a useMakefiledeveloped byLinuxapplication. ">
</enumvalue>
</enumproperty>
<Stringpropertysubtype="folder"Name="SourceRoot"DisplayName="Source root directory"Description="the source root directory that is expressed using relative paths. "Category=" General">
</stringproperty>
</ Rule >
Close VS again to open Project properties:
Here is a GNU configuration, in this GNU configuration, we can add options based on our own project needs,VS will save these options to the vcxproj project file. When MSBUILD compiles, these parameters can be passed to our custom compilation task.
It is important to note that in this XML file:
<datasource persistence =" projectfile " label =" configuration " hasconfigurationcondition =" true "/>
The Label here can only fill in a fixed value, such as configuration , Clcompile, Link , and so on, if it is not defined in the props file attribute values are not displayed correctly.
You can find a few more lines in the vcxproj file after you save it:
<GnuProjectType>LinuxKernel</GnuProjectType>
<SourceRoot>.</SourceRoot>
This means that our configuration has been properly saved!
Application of Vs2012 in Linux development (5): Definition of project Properties