Visual Studio post build event copy file to single or multi folders

post build event copy file Post built event copy exe file or dll file to another project by command line, mainly we will focus on "$(TargetDir)" and "$(TargetName)" to copy specific file.

Now with this code snippet we are going to copy exe file to another project location.
However, just in case if you want to copy multi location copy the same line to different directory

$(TargetDir) Command Line

"$(TargetDir) returns the path of bin folder inside the solution it can be either Debug or Release folder based on the built configuration Active setup in Microsoft Visual Studio.

$(TargetName) Command Line

$(TargetName) returns file name of specific exetention most case it will be .dll or .exe.

Download

Example Source Snippets - PostBuiltEvent.zip

Post build event copy single file


                    copy "$(TargetDir)$(TargetName).exe"  "C:\jack\code\Folder1\"                                          
       

Post build event copy multi folders


                    copy "$(TargetDir)$(TargetName).exe"  "C:\jack\code\Folder1\"    
                    copy "$(TargetDir)$(TargetName).exe"  "C:\jack\code\Folder2\"                                        
       

smartsnipps.ecomparefiles.com © 2019, All Rights Reserved | Disclaimer: smartsnipps.eCompareFiles.com is free to use any code snippets without guarantee