Automatically package event attributes generated by projects

Source: Internet
Author: User

From ---- http://www.cnblogs.com/fuhongwei041/archive/2011/03/30/1999392.html

In these two events, we can implement some of our compilation-related requirements, such as packaging and transferring some files to the Publishing Server after compilation.

Here, we will introduce an application case as follows: the process for releasing a job is to rename debug or release as bin, and then rename the bin directory and App. config

Compress into a zip package.

Step 1: Clear the last packaged file and directory (if any) in the pre-generated event, including deleting the folder $ (projectdir) bin \ bin,

Delete the file $ (projectdir) bin \ app. config, and delete the file $ (projectdir) bin \ jobs.zip.CodeAs follows:

 
1: IfExist "$ (projectdir) bin \ bin" RD/S/Q "$ (projectdir) bin \ bin"
 
2: IfExist "$ (projectdir) bin \ app. config" del/f/Q "$ (projectdir) bin \ app. config"
3: IfExist "$ (projectdir) bin \ jobs.zip" del/Q "$ (projectdir) bin \ jobs.zip"

Step 2: Create a folder $ (projectdir) bin \ bin in the later generation event, copy and generate the folder $ (projectdir) bin \ bin, and copy the file

$ (Projectdir) app. config to the folder $ (projectdir) bin \ bin. if 7z.exe exists, the folder $ (projectdir) bin \ bin and file

$ (Projectdir) bin \ app. config is compressed into a zip file $ (projectdir) bin \ jobs.zip. The Code is as follows:

 
1:Mkdir "$ (projectdir) bin \ bin"
 
2:Xcopy/e/y "$ (targetdir) *. *" $ (projectdir) bin \ bin"
 
3:Copy/y "$ (projectdir) app. config" "$ (projectdir) bin"
4: IfExist"% ProgramFiles % \ 7-zip \ 7z.exe"(
 
5: "% ProgramFiles % \ 7-zip \ 7z.exe"A-R "$ (projectdir) bin \ jobs.zip" "$ (projectdir) bin \ bin" "$ (projectdir) bin \ app. config"
 
6:)

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.