Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Monday, 12 September 2011

Visual studio 2010 run post build events based on debug or release mode

Using a batch file that should be run after post build is a common task. But some actions are not required in debug mode and some times in release mode.

To achieve this create 2 batch files
1. debugpostbuild.bat
2. releasepostbuild.bat

Update post-build event command line as follows:-
1. goto VS2010 -> right click on your project -> properties -> Build Events
2. copy below code

if $(ConfigurationName) == Release (
call $(SolutionDir)\debugpostbuild.bat
)
else (
call $(SolutionDir)\releasepostbuild.bat
)


That's it. so simple.

Any sufficiently advanced technology is indistinguishable from magic. ~Arthur C. Clarke

4 comments:

  1. Just this will do:
    call $(SolutionDir)\$(ConfigurationName)postbuild.bat

    ReplyDelete
  2. How can I use VS enviromnent variables like $(ProjectDir) within the bat file ?

    ReplyDelete
  3. Pass $(ProjectDir) as an argument to the batch file as :-

    call $(SolutionDir)\$(ConfigurationName)postbuild.bat $(ProjectDir)

    use %1 inside your batch file to refer to the argument passed

    ReplyDelete

Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers