Automatically Deploying an Application - Visual Studio

To automatically deploy an application upon successful build of the Release version, execute the following procedure.

Procedure

  1. In Solution Explorer, navigate to the startup project > Properties > double-click.
  2. Select the Build Events tab
  3. In the Post-build event command line field enter the following text, replacing MyCompany and MyApplication as appropriate.

if "$(ConfigurationName)" == "Release" goto :Deploy
goto :End
 :Deploy
C:
cd\Program Files\Jasinski Software\Desktop Widgets
copy "$(TargetDir)*.*" /y
 :End

Cautions

  1. Be sure the Run the post-build event drop-down shows "On successful build".
  2. Be sure to create the target directory. The script won't fail -- the files will simply be copied to the wrong directory.