Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.39 KB

createproperty-task.md

File metadata and controls

68 lines (51 loc) · 2.39 KB
title description ms.date ms.topic f1_keywords dev_langs helpviewer_keywords author ms.author manager ms.subservice
CreateProperty Task
Use the MSBuild CreateProperty task to populate properties with the values passed in, allowing values to be copied from one property or string to another.
11/04/2016
reference
VB
CSharp
C++
CreateProperty task [MSBuild]
MSBuild, CreateProperty task
ghogen
ghogen
mijacobs
msbuild

CreateProperty task

Populates properties with the values passed in. This allows values to be copied from one property or string to another.

Attributes

The following table describes the parameters of the CreateProperty task.

Parameter Description
Value Optional String output parameter.

Specifies the value to copy to the new property.
ValueSetByTask Optional String output parameter.

Contains the same value as the Value parameter. Use this parameter only when you want to avoid having the output property set by MSBuild when it skips the enclosing target because the outputs are up-to-date.

Remarks

In addition to the parameters listed above, this task inherits parameters from the xref:Microsoft.Build.Tasks.TaskExtension class, which itself inherits from the xref:Microsoft.Build.Utilities.Task class. For a list of these additional parameters and their descriptions, see TaskExtension base class.

Example

The following example uses the CreateProperty task to create the NewFile property using the combination of the values of the SourceFilename and SourceFileExtension property.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <PropertyGroup>
        <SourceFilename>Module1</SourceFilename>
        <SourceFileExtension>vb</SourceFileExtension>
    </PropertyGroup>

    <Target Name="CreateProperties">

        <CreateProperty
            Value="$(SourceFilename).$(SourceFileExtension)">
            <Output
                TaskParameter="Value"
                PropertyName="NewFile" />
        </CreateProperty>

    </Target>

</Project>

After running the project, the value of the NewFile property is Module1.vb.

See also