In the msbuild script below, the first time I run the csproject the following targets get executed in sequence:
1) UnzipDLL
2) DeleteExtraneousDirs
If I was to run the csproject for the second time, the following targets get executed in sequence:
1) UnzipDLL
2) CopyFiles
3) DeleteExtraneousDirs
I'm not sure why the "CopyFiles" target doesn't run the first time. I also tried specifying the target orders by adding "BeforeTargets", "AfterTargets", and/or "DependsOnTargets", but that didn't run the CopyFiles target after the UnzipDLL target.
Also, if I specify the DefaultTargets as only "UnzipDLL" and "CopyFiles", only the "UnzipDLL" task runs the first time I run the csproject project and both tasks "UnzipDLL" and "CopyFiles" run the second time the csporjects gets executed.
Below is the msbuild script. Thanks for the help!
<Project ToolsVersion="14.0" DefaultTargets="UnzipDLL;CopyFiles;DeleteExtraneousDirs" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ReleasePath>..\..\..\..\..\TDS</ReleasePath>
<RelDirectory>$(ReleasePath)\exe\dll\_rels</RelDirectory>
<LibDirectory>$(ReleasePath)\exe\dll\lib</LibDirectory>
</PropertyGroup>
<ItemGroup>
<LibFiles Include="$(ReleasePath)\exe\dll\lib\**\*.*;$(ReleasePath)\exe\dll\lib\*.*" />
</ItemGroup>
<Target Name="UnzipDLL">
<Unzip ZipFileName="$(ReleasePath)\exe\utils\TDS.Packages.1.0.0.nupkg"
TargetDirectory="$(ReleasePath)\exe\dll\" />
</Target>
<Target Name="CopyFiles">
<Copy SourceFiles="@(LibFiles)" DestinationFolder="$(ReleasePath)\exe\dll\%(RecursiveDir)" />
</Target>
<Target Name="DeleteExtraneousDirs">
<Delete Files="@(LibFiles)" />
<RemoveDir Directories="$(RelDirectory);$(LibDirectory)" />
</Target>
</Project>
UPDATE
To SergeyL's point, the CopyFiles target does get executed. But the Copy task doesn't copy the files from the exe\dll\lib folder to the exe\dll\ folder. I found this out by adding Message tasks before and after the Copy task.