I have a really simple build script that looks like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Bundle">
<ItemGroup>
<BuildArtifacts Include="..\_buildartifacts" />
<Application Include="..\_application" />
</ItemGroup>
<Target Name="Clean">
<RemoveDir Directories="@(BuildArtifacts)" />
<RemoveDir Directories="@(Application)" />
</Target>
<Target Name="Init" DependsOnTargets="Clean">
<MakeDir Directories="@(BuildArtifacts)" />
<MakeDir Directories="@(Application)" />
</Target>
<Target Name="Bundle" DependsOnTargets="Compile">
<Exec Command="xcopy.exe %(BuildArtifacts.FullPath) %(Application.FullPath) /e /EXCLUDE:$(MSBuildProjectDirectory)\files_to_ignore_when_bundling.txt" WorkingDirectory="C:\Windows\" />
</Target>
The problem is the Bundle target, only the %(BuildArtifacts.FullPath)
gets extracted, %(BuildArtifacts.FullPath)
is ignored when the scripts executes.
The command looks like this when executing:
xcopy.exe C:\@Code\blaj_buildartifacts /e /EXCLUDE:C:\@Code\blaj\files_to_ignore_when_bundling.txt" exited with code 4
As you can see, the destination path is not there, if I hard code the paths or just the destination path it all works. Any suggestion on what I am doing wrong here?
Update
I managed to solve the problem, I removed the last part WorkingDirectory="C:\Windows\"
And changed the script into this:
<Exec Command="xcopy.exe @(BuildArtifacts) @(Application) /e /EXCLUDE:$(MSBuildProjectDirectory)\files_to_ignore_when_bundling.txt" />
and now it's working :)
I managed to solve this. I've updated the question with the solution.
I removed the last part WorkingDirectory="C:\Windows\" And changed the script into this:
<Exec Command="xcopy.exe @(BuildArtifacts) @(Application) /e /EXCLUDE:$(MSBuildProjectDirectory)\files_to_ignore_when_bundling.txt" />
and now it's working :)