loresoft/msbuildtasks

Excluding multiple files

MikeRosoft opened this issue · 0 comments

I have the following in my project file:

  <ItemGroup>
    <PackageReference Include="MSBuildTasks" Version="1.5.0.235" GeneratePathProperty="true" />
  </ItemGroup>  
     
  <Import Project="$(PkgMSBuildTasks)\tools\MSBuild.Community.Tasks.Targets" Condition="Exists('$(PkgMSBuildTasks)\tools\MSBuild.Community.Tasks.Targets')" />
  
  <Target Name="ZipFiles" AfterTargets="AfterBuild">
    <ItemGroup>
      <FileList Include="$(ProjectDir)\$(OutDir)\*" Exclude="*.pdb;*.zip" />
    </ItemGroup>
    
    <Zip Files="@(FileList)" ZipFileName="$(ProjectDir)\$(OutDir)\PostInstallSetup.zip" WorkingDirectory="$(ProjectDir)\$(OutDir)" />

  </Target>

I have used the Include / Exclude format at https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-exclude-files-from-the-build , but this doesn't work: Exclude="*.pdb;*.zip" doesn't actually exclude the files (*.pdb;*.zip is apparently treated as a single pattern). So is it possible to exclude multiple file patterns?