Working with MSBuild and I need to copy the transform configuration file to various subdirectories.
I have code below within the body of my target
<ItemGroup>
<EnvironmentDirectory Include="Environment\BackUp_Recovery\"/>
<EnvironmentDirectory Include="Environment\IST\"/>
<EnvironmentDirectory Include="Environment\Production\"/>
<EnvironmentDirectory Include="Environment\UAT\"/>
</ItemGroup>
<!-- Copy task to copy file to environment folders -->
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetFileName).config"
DestinationFiles="@(EnvironmentDirectory -> '@(EnvironmentDirectory)$(TargetFileName).config')"
SkipUnchangedFiles="true">
<Output TaskParameter="CopiedFiles" ItemName="SuccessfullyCopiedFiles" />
</Copy>
As is, I get the following error message.
"DestinationFiles" refers to 4 item(s), and "SourceFiles" refers to 1 item(s). They must have the same number of items.
And when I look at output window, I observe the following
2>Task "Copy" (TaskId:73) 2> Task Parameter:SourceFiles=obj\Release\AIT.UI.WinForm.exe.config (TaskId:73) 2> Task Parameter: 2> DestinationFiles= 2> @(EnvironmentDirectory)AIT.UI.WinForm.exe.config 2> @(EnvironmentDirectory)AIT.UI.WinForm.exe.config 2> @(EnvironmentDirectory)AIT.UI.WinForm.exe.config 2> @(EnvironmentDirectory)AIT.UI.WinForm.exe.config (TaskId:73) 2> Task Parameter:SkipUnchangedFiles=True (TaskId:73) 2>C:\AITDevelopment\AIT.UI.WinForm\AIT.UI.WinForm.csproj(634,5): error MSB3094: "DestinationFiles" refers to 4 item(s), and "SourceFiles" refers to 1 item(s). They must have the same number of items. 2>Done executing task "Copy" -- FAILED. (TaskId:73)
I would appreciate any help in resolving this please. Thanks.