My site is ad supported.

Project Build Backup for Visual Studio (Windows Command Line Batch Script Utility)

Version 1.0.0 - Download | Download (Script Only)


Description

Creates a compressed archive of a development project's source folder. The archive's file name can optionally include a timestamp and custom text (tag) information as required.

For a guided walkthrough on how to use this tool in:

While this tool is designed for creating automated build backups in Visual Studio using a post-build event, it flexible enough to work with any variety of development environments.

Requirements:

  • 7za.exe

Examples

All the examples below are with respect to a Visual Studio post-build event.

This creates an archive in the format: <ProjectName>.zip (existing archive will be overwritten):

CALL ProjectBuildBackup "$(SolutionDir)" "$(ProjectDir)" "$(ProjectName)"

This creates an archive in the format: <ProjectName>_<ConfigurationName>_<YYYY-MM-DD_HHMM_day>.7z

CALL ProjectBuildBackup "$(SolutionDir)" "$(ProjectDir)" "$(ProjectName)" /T "$(ConfigurationName)" /D /7z

This command works the same as the first example above, but instead of placing the resulting archive in "<Solution Dir>\Builds", it is instead placed in "<Solution Dir>\Build Archives". If this folder does not exist, it is created.

CALL ProjectBuildBackup "$(SolutionDir)" "$(ProjectDir)" "$(ProjectName)" /O "Build Archives"


My site is ad supported.

Help Information (/?)

ProjectBuildBackup BackupToFolder ProjectPath ProjectName
                   [/O SubfolderPath] [/T Tag] [/D] [/7Z]

 BackupToFolder
          Root folder which holds the build backups. The actual backup
          archive will be placed in a subfolder of this directory.
 ProjectPath
          Root path of the project to backup. This folder should contain
          all the project files which need to be backed up.
 ProjectName
          Name of the project being backed up.
 /O SubfolderPath
          Subfolder, respective to the BackupToFolder, where the backup
          should be placed. Default value is "Builds".
          If this folder does not exist, it will be created.
 /T Tag   Additional text to append to the backup file name.
 /D       If provided, appends the current date/time to end of the backup
          file name. If both /T and /D are provided, /T is appended first.
 /7Z      If provided, the archive is created in .7z format instead of the
          default extension of .zip.


Backups are created in the following directory:
   <BackupToFolder>\{Builds | <SubfolderPath>}

File name generation formula:
   <ProjectName>[[_<Tag>]_<TimeStamp>].{zip | 7z}

Note that if the generated output file already exists, it will be overwritten.
It is recommended that that /D flag be used to help avoid this.