Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Excluding multiple files #301

@MikeRosoft

Description

@MikeRosoft

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions