2
如何将物品压扁成物业?如何将物品拼合成物业?
根据这MSDN page (section Conversions between Strings and Item Lists
),它只是一个声明属性与物品作为价值的问题。
但我发现实际做法完全相反。当我运行这个项目的MSBuild 4.0,指定目标install
...
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(Project-to-import)" Condition="'$(Project-to-import)' != ''" />
<ItemGroup>
<RuntimeProj Include="C:\TEMP\Design.proj" />
<DesigntimeProj Include="C:\TEMP\Run.dproj" />
</ItemGroup>
<PropertyGroup> <!-- Flatten out the items to properties. -->
<RuntimeProj>@(RuntimeProj)</RuntimeProj>
<!--^This bit doesn't work. MS documentation is wrong? -->
<DesigntimeProj>@(RuntimeProj)</DesigntimeProj>
</PropertyGroup>
<Target Name="install">
<Message Text="Hello world!"/>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="BuildRunPackage"
Properties="Project-to-import=$(RuntimeProj)" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="BuildDesignPackage"
Properties="Project-to-import=$(DesigntimeProj)" />
</Target>
<Target Name="BuildRunPackage">
<CallTarget Targets="Clean" />
<CallTarget Targets="Build" />
</Target>
<Target Name="BuildDesignPackage">
<CallTarget Targets="Clean" />
<CallTarget Targets="Make" />
<CallTarget Targets="Register" />
</Target>
<.Project>
...返回一个错误......
错误MSB4012:表达式“项目,TO-进口= @(RuntimeProj)不能在这种情况下使用。项目列表不能与其中一个项目列表,预计其他字符串并置。使用分号来分隔多个项目清单。
是的。这是做到这一点的方法。你必须在''中平整属性。 –