开发者

Is there a possibility to use one property value inside another?

开发者 https://www.devze.com 2022-12-18 09:22 出处:网络
I would like to do something like this: <PropertyGroup> <propone>value</propone> </PropertyGroup>

I would like to do something like this:

<PropertyGroup>
<propone>value</propone>
</PropertyGroup>

<PropertyGroup>
<proptwo>$(propone)</proptwo>
</PropertyGroup>

Pass one pro开发者_运维百科perty value as another. Is there a way to do this? How?


I think you provided the answer right there in your question: yes, it is possible in just the way that you suggested.

An example:

<Project ToolsVersion="3.5" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <SomeProperty>Some Property Value</SomeProperty>
  </PropertyGroup>
  <PropertyGroup>
    <SomeOtherProperty>$(SomeProperty) with something added to it</SomeOtherProperty>
  </PropertyGroup>
  <Target Name="Test">
    <Message Text="$(SomeOtherProperty)" />
  </Target>
</Project>

This will print Some Property Value with something added to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消