0
votes

we developer web pages in PHP and we must use Visual studio 2010 with Team foundation Server 2010. We try to create simple "build process" on TFS to copy our php files to drop folder.

I am using: DefaultTemplate.xaml And created my own: simple_zip.proj for MSBuild proces with following code:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <MySourceFiles Include="**\*.php"/>
    </ItemGroup>

    <Target Name="CopyFiles">
        <Copy SourceFiles="@(MySourceFiles)" DestinationFolder="c:\MyProject\Destination" />
        <Message Text="My Build Complete" />
    </Target>
</Project>

And this works and copies to the server local path.

The problem is if I try to use any of MSBuild variables it does not work, like

Message Text="My Build Complete - $(BuildDir) - $(TargetDir) - $(BuildProjectFolderPath)>"

My text is displayed but variables are empty (I am looking debug level log files of msbuild process).

Also anything from the following link, simply does not work. Customizable Team Foundation Build Targets

So my question is, how can I get all path variables (sources dir, binaries dir, drop folder dir, build number and others from build definition/template) to my MSBuild on the TFS server ?

Thank you Kind regards

1
In your previous post you've asked about BuildNumber. You should youself pass all required values through command line in the same way as for BuildNumbersll

1 Answers

0
votes

I don't see your project importing any standard targets. I do a similar thing in one of my project files and it looks a bit like this:


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
 <DeploymentDir>$(OutDir)\MySubFolder\</DeploymentDir>
</PropertyGroup>
<ItemGroup>
 <DeploymentContent Include="**\*.ps1" />
</ItemGroup>
<PropertyGroup>
 <DevDeploymentImageDir>$(DeploymentDir)Dev\</DevDeploymentImageDir>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<!-- Empty targets for this project since it just copies files from one location to another.-->
<Target Name="BeforeBuild"/>
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" />
<Target Name="AfterBuild" >
  <MakeDir Directories="$(DeploymentDir)" />
  <MakeDir Directories="$(DevDeploymentImageDir)" />
  <Copy SourceFiles="@(DeploymentContent)" DestinationFolder="$(DevDeploymentImageDir)" />
</Target>

Another good thing to try is turning on more verbose MSBuild logging on your TFS machine (like the level 'diag') so you can see MSBuild variables getting set along the way as the build progresses.