Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding multiple files #301

Open
MikeRosoft opened this issue Sep 19, 2022 · 0 comments
Open

Excluding multiple files #301

MikeRosoft opened this issue Sep 19, 2022 · 0 comments

Comments

@MikeRosoft
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant