<ItemGroup>
<Values Include="*.*" />
</ItemGroup>
<PropertyGroup>
<Name>Values</Name>
</PropertyGroup>
<Target Name="DisplayContent">
<!-- works in a traditional way: -->
<Message Text="@(Values)" />
<!-- wish could do something like this: -->
<Message Text="@($(Name))" />
</Target>
有没有办法通过利用MSBuild中字符串表达式所拥有的名称来获取列表/属性的值?
答案 0 :(得分:0)
我认为您希望使用$(Name)变量作为导入特定ItemGroup的条件。你可以这样做:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Values Include="A1;A2;A3" />
</ItemGroup>
然后你有ListA.prop
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Values Include="B1;B2;B3" />
</ItemGroup>
对于ListB.prop
class Specification < ActiveRecord::Base
has_many :prices, inverse_of: :specification
validates :prices, presence: true
class Price < ActiveRecord::Base
belongs_to :specification, inverse_of: :prices
validates :specification, presence: true
因此,您只需使用基于变量的条件加载所需的列表,而不是使用具有不同名称的多个列表。