We use TFS 2010 with VS 2010 for PHP web projects. Actually we do not have any .proj or .sln file, so i have made my own to make builds, it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<ItemGroup>
<ZipFiles Include="**\*.*"/>
</ItemGroup>
<Target Name="Zip" >
<Zip Files="@(ZipFiles)" ZipFileName="$(OutDir)myzip.zip" />
</Target>
<Target Name="Build" DependsOnTargets="Zip">
<Message Text="My Build Complete - $(BuildNumber) - $(TeamProject) - $(BuildProperties)" />
</Target>
<Target Name="AfterBuild">
<MakeDir Directories="Testing" />
<Message Text="My AfterBuild- $(BuildNumber) "></Message>
</Target>
</Project>
I have configured build numbers in build definition in VS as "$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)" , and drop folder on network path is created correctly.
The problem is that $(BuildNumber) or $(TeamProject) or $(BuildProperties) are empty. Also it seems that "My Afterbuild" is never executed.
Why are my variables empty and how to get build number from build definition as specified?
To run
AfterBuild
targets:For me is not clear why
Zip
target should be executed before theBuild
target?EDIT:
You have to update template file
defaultTemplate.XAML
by adding manually BuildNumber to the MSBuild command line so command Line would be like:See the original article regarding this trick: TFS2010 – Where is $(BuildNumber)?