Wrong variable name. GenerateDuringBuild is for another task. Lesson Learned. Do not copy and paste.
Trouble with MSBuild Copy
-
29-06-2022 - |
Question
Hi I have the following target.
<Target
Name="TestCopy"
AfterTargets="BeforeBuild"
>
<Message
Text="Copying base Sitecore config files @(GenerateDuringBuild)
%(GenerateDuringBuild.RootDir)%(GenerateDuringBuild.Directory)UpdatedConfiguration\%(GenerateDuringBuild.Filename)\%(GenerateDuringBuild.Filename)%(GenerateDuringBuild.Extension)
%(GenerateDuringBuild.RootDir)%(GenerateDuringBuild.Directory)UpdatedConfiguration\%(GenerateDuringBuild.Filename)\%(GenerateDuringBuild.Filename)%(GenerateDuringBuild.Extension).test
"
/>
<Copy
SourceFiles="%(GenerateDuringBuild.RootDir)%(GenerateDuringBuild.Directory)UpdatedConfiguration\%(GenerateDuringBuild.Filename)\%(GenerateDuringBuild.Filename)%(GenerateDuringBuild.Extension)"
DestinationFiles="%(GenerateDuringBuild.RootDir)%(GenerateDuringBuild.Directory)UpdatedConfiguration\%(GenerateDuringBuild.Filename)\%(GenerateDuringBuild.Filename)%(GenerateDuringBuild.Extension).test"
Condition="!Exists('%(GenerateDuringBuild.FullPath)')"
/>
</Target>
The Message outputs the correct paths but does not do the copy.
The file does not exist.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow