Reputation: 691
I have included my project dependencies files to C# project from directory in my project with name "Dependencies" that include every file that project need to this project sub directory (because i don't want the project seems crowded and add needed file to "Dependencies" sub directory) but i don't want the sub directory copied to output path. I want only content of sub directory with all structure copied to output path. I don't want use post built Copy command because i have unneeded files and folders that i don't want copied to output directory. Is there any way to do this?
Upvotes: 1
Views: 2250
Reputation: 310
I often use robocopy "jobs" for this, which allows to save a job description file which tells robocopy what to include and where to copy. So my Post-Build Event would be along the lines of
robocopy $(ProjectDir)\dependencies $(ProjectDir)$(OutDir) /JOB:$(ProjectDir)\dependencies\publish
The job file is then called publish.rcj and also placed in the dep. directory
Another way of doing it is to create a setupproject that gathers the resources you need, but that is even more work :-)
Here goes. ROBOCOPY
robocopy /?
gives you the help you need to figure it out :) Here is one to get you started:
robocopy c:\source c:\target /S /E /XD systems /XF publish.rcj /NP /NJS /NJH /NFL /NDL /SAVE:publish.rcj
Explanation of some settings:
Now a "trick" (can't seem to make this work correctly from command line): Open the job file (publish.rcj) and substitute:
/SD:c:\Source With /NOSD
and
/DD:c:\Target With /NODD
Now you can call the job like this:
robocopy c:\my_new_source c:\my_new_target /job:publish
And it will use all the paramteres specified in the job description file.
Upvotes: 2