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)不能在這種情況下使用。項目列表不能與其中一個項目列表,預計其他字符串並置。使用分號來分隔多個項目清單。
是的。這是做到這一點的方法。你必須在''中平整屬性。 –