- | rssFeed | My book on MSBuild and Team Build | Archives and Categories Wednesday, 28 December 2005

MSBuild CreateProperty[Item] and CallTarget bug

It seems like I'm constantly moving files from one place to another, I think this is because I have way too many storage/machine options. (As a side note, my personal storage capacity is at 800GB currently...thats scary.) I wanted to have a means to cleanly and easily snyc up these files. I was considering purchasing (or finding online) a sync tool, but I didn't want to go that route because a friend of mine, Daniel Brookshier, lost about 4 days of work due to an error with the sync tool. I'm not sure what the error was. So I decided to forget about that approach. Instead I wanted to write an MSBuild project file to do the syncing for me. The idea was to have an MSBuild file that I could place in whatever directories that I wanted to snyc, then I could define the various different locations that I wanted to store these files; ie where on my notebook, where on my desktop; where on my removable media X.
Anywayz to make a long story short I discovered a bug in MSBuild! It creeps up when you invoke the CreateProperty or CreateItem, then invoke CallTarget that will reference that newly created property or item. To clariify this have a look at this simple MSBuild project file.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Create">
    <
Target Name="Create">
        <
CreateProperty Value="E:\Data">
            <
Output TaskParameter="Value" PropertyName="DestFolder" />
        </
CreateProperty>
        <
CreateItem Include="*.*">
            <
Output TaskParameter="Include" ItemName="TestFiles"/>
        </
CreateItem>
       
       
<CallTarget Targets="Print"/>
    </
Target>

    <Target Name="Print">
        <
Message Text="Dest: $(DestFolder)"/>
        <
Message Text="TestFiles: @(TestFiles)"/>
    </
Target>

</Project>

This file is pretty simple, 2 targets; Create target will create an Item and a Property dynamically then the Print target is called. This will simply print the values the property and item just created. If you have MSBuild invoke the Create target you'll find that this doesn't work. For one reason or another a target called with CallTarget in the same target that properties/items are create in (using CreateProperty or CreateItem) doesn't get the value of those properties/items. I filed a bug report and they will look into fixing this for the next version evidently. You can read up at: http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=74e5cb0e-4075-4c7e-9660-c130f94df465 

I've included a zip file containing 2 project files, the one above and one that will show the expected behavior.

sample.zip (.95 KB)

Sayed Ibrahim Hashimi

msbuild | Visual Studio Wednesday, 28 December 2005 05:03:03 (GMT Standard Time, UTC+00:00)  #     |  Tracked by:
"Well Known Limitation: Dynamic items and properties not emitted until target ex... [Trackback]
"MSBuild CreateProperty bug workaround" (Sayed Ibrahim Hashimi) [Trackback]
http://www.sedodream.com/PermaLink,guid,44ef8e1e-735f-40c5-92e9-4d7e31590c5d.asp... [Pingback]
"Bonus Code Party Poker" (poker) [Trackback]
"buy bupropion" (online) [Trackback]
"buy cleocin" (online) [Trackback]
"diet food" (online) [Trackback]
"calculator debt" (on line) [Trackback]
"phentermine online" (on line) [Trackback]
"robots cheap international flight" (air online) [Trackback]
"free roulette" (casino online) [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]
"zyban side affects" (zyban side affects) [Trackback]