Post-build event, post-event

Source: Internet
Author: User

Post-build event, post-event

Ref: http://blog.csdn.net/teng_ontheway/article/details/8307410

Ref: http://blog.csdn.net/sodickbird/article/details/4826068

Requirement:

Requirement: Maybe we need to release a version for the artist. Then we need to put *. exe, *. dll and resources in a folder and synchronize them to the artist.

Problem:The directory generated by Wait .exe may be inconsistent with the Resource Directory during the generation project., Cannot always be compiled onceManualCopy the generated .exe and dll to the Resource Directory.

 

Solution: Use the post-generation batch processing command that comes with visual studio

Visual studio-> right-click the project-> properties-> Build Events-> Post-Build Event-> Command Line

Xcopy $ (OutDir) $ (TargetFileName) $ (ProjectDir) .. \ Resources \/Y


This command is used to copy the exe files under the generated directory to the Resources folder under the upper-level directory of the project directory.

Notes:

1. $ (OutDir) and other macro paths are included '\'
2. After the event is generated, xcopy actually runs a console command, so the command does not support '/'
Like a previously written error command

Xcopy $ (OutDir) $ (TargetFileName) $ (ProjectDir) ../Resources \/Y

An error is prompted during running.

3. "/Y" is a parameter, indicating that if the same file exists, it will be replaced.

You can also copy the entire folder.

Xcopy "$ (ProjectDir) controls" $ (TargetDir) .. \ app1 \ controls "/y/I/e/exclude: CodeFilesToExclude.txt


For specific parameters, refer to the CMD console to view specific xcopy functions...

 

Bin Folders

Each project shocould write their output toBinFolder under each ofDev Folders.BinShocould NOT be checked into TFS, but shocould be created via a post-build event or by changing the project's output path.

If post-build events are used, the following is a sample which assumes the solution in the root directory:

@ Echo if not exist "$ (SolutionDir) Cloud \ bin \" (mkdir "$ (SolutionDir) Cloud \ bin \")
If not exist "$ (SolutionDir) Cloud \ bin \" (mkdir "$ (SolutionDir) Cloud \ bin \")
@ Echo copy/Y "$ (TargetDir) $ (TargetName). *" $ (SolutionDir) Cloud \ bin \"
Copy/Y "$ (TargetDir) $ (TargetName). *" $ (SolutionDir) Cloud \ bin \"

Note: Make sure youEchoStatements beforeyou execute them. This can help in debugging post-build failures in build logfiles.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.