当单个属性包含分号时,在项目组中使用时,MSBuild 会自动将该属性解析为属性列表。这是我项目的一个片段:
<PropertyGroup>
<ConnectionString>workstation id=.;packet size=4096;Integrated Security=SSPI;data source=.;initial catalog=$(SqlDbName)</ConnectionString>
</PropertyGroup>
<ItemGroup>
<InstallShieldProperties Include="
CONNECTIONSTRING=$(ConnectionString);
Another=$(value)"/>
</ItemGroup>
当任务使用 @(InstallShieldProperties) 项目组时,MSBuild 会将 ConnectionString 属性解析为子集属性列表,因为它包含分号。
foreach (string property in Properties)
{
// Properties array parsed to pieces
}
我知道我可以更改项目组的分隔符,但这不会有任何区别。我试图避免在自定义任务中操作 string[] 数组。