SirMike

I'm trying to add a custom target to the team build (class library) by adding:

<Target Name="BeforeDropBuild">
<Message Text="Copying files" Importance="low" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="\\server\assembly" ContinueOnError="false" />
</Target>

but this target does not even start Sad I tried many others (also with setting dependency) - without success.
Can anybody tell me what am I doing wrong



Re: Team Foundation Server - Build Automation Custom targets don't work :(

Aaron Hallberg - MSFT

The most likely issue is that you put your target override before the <Import> of Microsoft.TeamFoundation.Build.targets in your TfsBuild.proj file - in this case, the (empty) declaration of the target within our targets file will override yours, and your logic won't execute.

-Aaron






Re: Team Foundation Server - Build Automation Custom targets don't work :(

SirMike

No, I put my target at the very end of TfsBuild.proj file. Please look at this file. Any hints will be appreciated.

Code Block

< xml version="1.0" encoding="utf-8" >
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
<ProjectExtensions>
<Description>Build of MyAssembly</Description>
<BuildMachine>buildserver</BuildMachine>
</ProjectExtensions>
<PropertyGroup>
<TeamProject>test</TeamProject>
<BuildDirectoryPath>d:\build</BuildDirectoryPath>
<DropLocation>\\buildserver\build\Droplocation</DropLocation>
<RunTest>false</RunTest>
<WorkItemFieldValues>Symptom=build break;Steps To Reproduce=Start the build using Team Build</WorkItemFieldValues>
<RunCodeAnalysis>Never</RunCodeAnalysis>
<UpdateAssociatedWorkItems>true</UpdateAssociatedWorkItems>
<WorkItemTitle>Build failure in build:</WorkItemTitle>
<DescriptionText>This work item was created by Team Build on a build failure.</DescriptionText>
<BuildlogText>The build log file is at:</BuildlogText>
<ErrorWarningLogText>The errors/warnings log file is at:</ErrorWarningLogText>
</PropertyGroup>
<ItemGroup>
<SolutionToBuild Include="$(SolutionRoot)\test\test.sln" />
</ItemGroup>
<ItemGroup>
<ConfigurationToBuild Include="Release|Any CPU">
<FlavorToBuild>Release</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
<ConfigurationToBuild Include="Debug|Any CPU">
<FlavorToBuild>Debug</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
</ItemGroup>
<ItemGroup>
<MetaDataFile Include=" ">
<TestList> </TestList>
</MetaDataFile>
</ItemGroup>
<ItemGroup>
</ItemGroup>

<Target Name="BeforeDropBuild">
<Message Text="Deploying" Importance="low" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="\\server2\assembly\test" ContinueOnError="false" />
</Target>
</Project>







Re: Team Foundation Server - Build Automation Custom targets don't work :(

Aaron Hallberg - MSFT

Hmm... This looks fine. Are you sure your target is not executing With "low" importance, your message will not typically show up in your logfile - the default verbosity for the file logger in MSBuild 2.0 is "Normal", which will only display messages with "Normal" or "High" importance.

If this doesn't appear to be the issue (i.e. if your target really isn't executing), can you attach a log file so we can diagnose the issue better

-Aaron




Re: Team Foundation Server - Build Automation Custom targets don't work :(

SirMike

Thanks for a hint. Indeed, the task executes fine (I changed importance to "normal), it's written to a logfile.
Copy task does not work in my case.





Re: Team Foundation Server - Build Automation Custom targets don't work :(

Aaron Hallberg - MSFT

Do you need help with figuring out the Copy task, or are you all set (It looks to me like the TargetPath property isn't set anywhere... If you're trying to copy the contents of a directory recursively, see the MSBuild team's blog post here: http://blogs.msdn.com/msbuild/archive/2005/11/07/490068.aspx)

-Aaron






Re: Team Foundation Server - Build Automation Custom targets don't work :(

SirMike

After several hours of trying I must say yes - I need help.
I am trying to copy compiled dll to another location. The problem is - I don't know where is the initial location of this task. Can you tell me what should I put into SourceFiles attribute I would like to avoid any hardcodings so it would be nice to put there any relative path to a droplocation.





Re: Team Foundation Server - Build Automation Custom targets don't work :(

Swaha Miller

You can use $(DropLocation) for your drop location when specifying paths relative to it. However, it looks like you are trying to execute the copy before the output is dropped into the drop location so the source files for the copy task will not exist at that location. For the dir where the dlls are built into on your build machine, use $(OutDir).

Swaha





Re: Team Foundation Server - Build Automation Custom targets don't work :(

SirMike

Thank you. Is there any index of these variables in the documentation