Reputation: 1415
All I'm doing is trying to keep track of the number of times a certain target gets called. Is it possible to do this using msbuild?
EDIT:
I tried doing something like this:
<Message Text ="The sum of $(NumberOne) and $(NumberTwo) is $([MsBuild]::Add($(NumberOne),$(NumberTwo))"/>
but that didn't work either. My output was The sum of 2 and 3 is $([MsBuild]::Add($(NumberOne),$(NumberTwo))
As for the suggestion to use an Item: I guess I could use some more information. I did some reading on Items, but don't see how they can be used as integers. It looks as thought they're for file collections.
Upvotes: 5
Views: 1607
Reputation: 3454
And your example work fine, you just have mistake in class name: it should be [MSBuild], not [MsBuild]
<Message Text ="The sum of $(NumberOne) and $(NumberTwo) is $([MSBuild]::Add($(NumberOne), $(NumberTwo)))">
Upvotes: 3
Reputation: 71
Yes there is. Create an item and then use Math.Add to increment it:
<Math.Add Numbers="$(ITEM);1">
<Output TaskParameter="Result" PropertyName="ITEM"/>
</Math.Add>
Upvotes: 1