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:)