1
我有以下MSBuild目標工作。MSBuild - 將ItemGroup保存在單獨的文件中
<Target Name="MyTarget">
<ItemGroup>
<ExcludeList Include="$(ProjectPath)\**\.svn\**"/>
<ExcludeList Include="$(ProjectPath)\**\obj\**"/>
<ExcludeList Include="$(ProjectPath)\**\*.config"/>
<ExcludeList Include="$(ProjectPath)\**\*.cs"/>
<ExcludeList Include="$(ProjectPath)\**\*.csproj"/>
<ExcludeList Include="$(ProjectPath)\**\*.user"/>
</ItemGroup>
<ItemGroup>
<ZipFiles Include="$(ProjectPath)\**\*.*" Exclude="@(ExcludeList)" />
</ItemGroup>
<Zip Files="@(ZipFiles)"
WorkingDirectory="$(ProjectPath)"
ZipFileName="$(PackageDirectory)\$(ProjectName).package.zip"
ZipLevel="9" />
</Target>
我想存儲ExcludeList的ItemGroup在一個單獨的文件,因爲我將在獨立的文件,所有需要使用列表中的多個MSBuild的目標,我不想重新創建和維護多份。
外部化ItemGroup並將其加載到多個msbuild腳本中的最佳方式是什麼?
@Hussom我試過。當我將ItemGroup元素移動到單獨的文件,然後使用導入時,ExcludeList屬性從原始目標中爲空。你能在你的答案中包括一個工作樣本嗎? – RationalGeek
@Hussom謝謝。這個樣本對我有用。現在要弄清楚爲什麼它在我的實際腳本中不起作用... – RationalGeek
是否在Project屬性中限定了正確的路徑? – Huusom