- | rssFeed | My book on MSBuild and Team Build | Archives and Categories Wednesday, June 14, 2006

MSBuild: Pre/Post build event funniness

In previous versions of the Visual Studio the build customizations were basically limited to a PreBuildEvent and a PostBuildEvent. Now we have MSBuild which allows for many very specific and complex build customizations. But Microsoft obvioiusly must continue to support the Pre/Post build event. It is something that already exists, many people are familiar with it, and its very simple. Let’s see how this is implemented within MSBuild. If you add a Pre or Post build event from Visual Studio, then examine yore project file you’ll find something like the following declared.



    <PostBuildEvent>echo 'This is the post build event!'</PostBuildEvent>



So these events are actually simple properties that will be executed when the time is right. What does this mean for you? Now lets talk about what’s funny about this. When MSBuild loads your project file it will load all of the properties contained in PropertyGroup elements, followed by that your items will be evaluated. What this means for the Pre/Post build event is that you are able to access properties that have been declared in PropertyGroup element before the Pre/Post build event declaration. After this evaluation is made the value for the Pre/Post build event will not change! What this equates to is that you are able to use properties such as OutDir or AssemblyName, but you’ll never be able to access properties that are created from tasks contained in other targets! If you need to access properties that have been created by other targets then you’ll have to extend your build process outside of the Pre/Post build event. This is outlined in my MSDN article Inside MSBuild in the Extending the Build Process section.

This entry was inspired by a post on the MSDN MSBuild forum.


Sayed Ibrahim Hashimi

msbuild | Visual Studio Wednesday, June 14, 2006 5:52:03 AM (GMT Daylight Time, UTC+01:00)  #     |  Tracked by:
"buy cheap phentermine no prescription" (6pm by order phentermine) [Trackback]
"manga hard" (manga hard) [Trackback]
"Charles Rawlings New Hampshire" (Charles Rawlings New Hampshire) [Trackback]
"maryland automotive windshield" (maryland automotive windshield) [Trackback]
"phentermine online pharmacies" (phentermine online pharmacies) [Trackback]
"discount gas lanterns" (discount gas lanterns) [Trackback]
"culo pia bello" (culo pia bello) [Trackback]
"prittiest amatoriali merda" (prittiest amatoriali merda) [Trackback]
"king kong the movie" (king kong the movie) [Trackback]
"dieta dimagrante vegetariana" (dieta dimagrante vegetariana) [Trackback]
"orologeria milano" (orologeria milano) [Trackback]
"camino barbecue" (camino barbecue) [Trackback]
"offerta praga" (offerta praga) [Trackback]
"divertente tedesco orale fotti" (divertente tedesco orale fotti) [Trackback]
"congelatore da incasso" (congelatore da incasso) [Trackback]
"Free Cum Shots" (Free Cum Shots) [Trackback]
"march 11%2c 2004" (march 11%2c 2004) [Trackback]
"wild panty porn" (wild panty porn) [Trackback]
"phone card" (phone card) [Trackback]
"wrestling shoes and apparel" (wrestling shoes and apparel) [Trackback]
"live adult amateur webcam" (live adult amateur webcam) [Trackback]
"columbus ohio commercial real estate" (columbus ohio commercial real estate) [Trackback]
"amateur lesbian full video" (amateur lesbian full video) [Trackback]
"masturbating womens" (masturbating womens) [Trackback]
"disneyland tickets" (disneyland tickets) [Trackback]
"self inflating mattress" (self inflating mattress) [Trackback]
"racconto erotici con animali" (racconto erotici con animali) [Trackback]
"female ejaculation personal experiences" (female ejaculation personal experienc... [Trackback]
"west virginia dui law" (west virginia dui law) [Trackback]
"cutie fighette sesso" (cutie fighette sesso) [Trackback]
"san francisco nose job" (san francisco nose job) [Trackback]