Application of Vs2012 in Linux development (5): Definition of project Properties

Source: Internet
Author: User

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

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.