Exclude a configurable list of files from copy in msbuild

570 Views Asked by At

Extending following post Trying to exclude certain extensions doing a recursive copy (MSBuild) .

I want to exclude a list of file which is defined in property group so that I can configure it in teamcity/jenkins

 <PropertyGroup>
    <BuildConfiguration>Release</BuildConfiguration>
    <Version>1.0.0.0</Version>
    <MajorVersion>1</MajorVersion>
    <MinorVersion>0</MinorVersion>
    <Revision>0</Revision>
    <Build>0</Build>
    <ExcludedFiles>file1.dll;file2.dll</ExcludedFiles>

  </PropertyGroup>  

Now i want to exclude these as following

<ItemGroup>
      <ReleaseFiles Include="$(PathToOutput)\**\*.*" Exclude="$ExcludedFiles"/>
    </ItemGroup>
    <!--Copy files from Release directory to Version folder -->
    <Copy SourceFiles="@(ReleaseFiles)"
        DestinationFiles="@(ReleaseFiles->'$(DeployVersionPath)\%(RecursiveDir)%(Filename)%(Extension)')" />

what is correct syntax for defining my property group("ExcludedFiles") and how can I take care of paths. given that all the excluded files are in same folder($(PathToOutput))?

0

There are 0 best solutions below