Using Visual Studio Build Events

Sometimes we may need to perform some action before or after the build process of visual studio.

A simple case can be, when we open a solution which contains several projects and websites, and few of the websites hosted in IIS virtual directory, and we need to check the websites after build using IIS server.

One solution can be to build the project folders as virtual directory so that they are directly available. But if for some reason that is not desired or say we need to put files together from 2 or more project into the IIS website (combined copy), in that case we can use the post build event to copy paste the required file in the location.

Pre Build event can be configured as well in this way.

Step 1:

Select the project and go to properties, then Build event.

Step 2:

If you press Edit Post Build, a popup will come. Here you can write down your desired commands.

For example, i wrote commands to create few folders and copy some required files inside the IIS hosted websites.

Step 3:

You can click the Macro button to see some listed helpful macros that can make your task easy.

Published 09-25-2009 6:49 PM by Jalal
Filed under:
Powered by Community Server (Non-Commercial Edition), by Telligent Systems