visual studio - MSBuild copy entire directory while using metadata in path names -
here few other similar answers i've found, none answers question:
copying entire project structure directory using afterbuild task
copy files , folders using msbuild
what i'm trying do:
i need copy directory tree several different places in project upon compilation. here how presently being done:
<itemgroup> <mediafiles include="$(projectdir)media\**\*.*" /> <deploylabel include="$(projectdir)deploy\x"> <dir>x</dir> </deploylabel> <deploylabel include="$(projectdir)deploy\y"> <dir>y</dir> </deploylabel> <deploylabel include="$(projectdir)deploy\z"> <dir>z</dir> </deploylabel> </itemgroup> <target name="genericdeploy" inputs="@(deploylabel)" outputs="%(identity).dummy"> <message text="deploying: @(deploylabel)" /> <copy sourcefiles="@(mediafiles)" destinationfiles="@(mediafiles->'$(projectdir)deploy%(dir)media\%(recursivedir)%(filename)%(extension)')"/> this pretends run, copies nothing @ all. i've tried use %(deploylabel.dir), gives me error.
i don't want use xcopy because program doesn't seem in default inventory of windows installs (my pc doesn't have it). also, must confess, don't entirely understand % thingy do. when saw @ , % @ first, thought copied make, i' starting doubt... insight -> means (it's extremely difficult find documentation on these cryptic names).
ok, solved somehow, i'm still interested in answering "bonus" questions / perhaps solution isn't good:
i added propertygroup inside target , concatenated path there:
<propertygroup> <deploydir>$(projectdir)deploy\%(deploylabel.dir)\media</deploydir> </propertygroup> and later in target used
destinationfiles="@(mediafiles->'$(deploydir)\%(recursivedir)%(filename)%(extension)')" instead, avoided problem percents (possibly) coming 2 different places.
Comments
Post a Comment