tags:

views:

969

answers:

2

I am attempting to use CI on a Branch of one of my TFS projects. MSBuild only fails when I try to use a Branch. I point the same Build at the "trunk" project it works fine.

The error I receive from the build log:

Task "Label"

Label TeamFoundationServerUrl="http://TFSServer:8080/" BuildUri="vstfs:///Build/Build/6763" Name="Test_SF_20090619.1" Scope="$/MyProject" Recursive=True Comments="Label created by Team Build" Version="BuildServer3D143_66" Child="Replace" Files="$/" C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(812,5,812,5):

error : No matching items found in $/ in your workspace.

Done executing task "Label" -- FAILED.

Done building target "CoreLabel" in project "TFSBuild.proj" -- FAILED.

I believe this error is being caused by a lack of source files getting copied to the Build server.

Get task excerpt from build log:

Task "Get"

Get TeamFoundationServerUrl="http://TFSServer:8080/" BuildUri="vstfs:///Build/Build/6768" Force=True Overwrite=False PopulateOutput=False Preview=False Recursive=True Version="C204806" Workspace="BuildServer3D143_66"

Done executing task "Get".

This is a full build. There should be about a thousand files listed in the GET.

General Information

  • TFS 2008
  • Visual Studio 2008
  • Established build server (been running builds for the last year)
  • Project being branched is a ASP.NET web stie (2.0 Framework).

Full Build Params

  • /p:SkipClean=false
  • /p:SkipInitializeWorkspace=false
  • /p:ForceGet=true
  • /p:IncrementalBuild=false
  • /p:IncrementalGet=false

note: I know IncrementalBuild is redundent but I just wanted to be sure.

Questions:

  • Are there restrictions on builds off a branch?
  • Any idea why MSBuild fails to pull files from the branch workspace?
A: 

If it's for CI then you're most likely doing an Incremental Get. TFS will only bother to get files it thinks have changed since its last get - e.g. if you delete any files from your server, it will still think you have those files so it won't get them again. In this case you'll need to run the build once with the incremental properties turned off so that it forces a full get of the source. You can do this by overriding the properties in the MSBuild command line box in the Queue Build dialog with:

/p:IncrementalGet=false;ForceGet=true

Another possibility that springs to mind is that the Label task is confused by your branch. It may be that your workspace is set up incorrectly, so check that you're mapping in everything it needs.

Jason Williams
I put my build parameters above. Even after adding /p:IncrementalGet=false, no luck. It might very well be the mapping; but if so, i am unsure as to why. There is only one workspace mapped for that TFSProject. It is at the root $/MyProject. Both the trunk and the branch are sub folders of that project. I tried adding a workspace mapping specifically to the branch but TFS just removes it as a duplicate mapping.
I'd suspect it's something about the way the branch is set up, but I don't know enough about MSBuild under those circumstances to suggest anything more I'm afraid.
Jason Williams
Cool. thanks for trying.
A: 

I had two issues in this case.

First, the branch security did not give rights to the build service account. I had restricted the branch to our team's Tech Leads and Release Engineers. The build service account needed access as well. What tipped me of was while searching the internet I stumbled upon a posting by someone who had made the same mistake.

The second issue was a little more involved. While cleaning up my build project file, I removed the following section.

<SolutionToBuild Include="$(BuildProjectFolderPath)/../../_stage/MyProject/MySolution.sln">
        <Targets></Targets>
        <Properties></Properties>
</SolutionToBuild>

Which worked fine on projects I had already built at least once, but if this was a new build, that had not copied source files to the build server, then there would be no files and the build would fail.

Some of you may wonder if my other builds were working either, after all wouldn’t they have old build files. Yes, but I had targets defined that did all the work I actually cared about. So the SolutionToBuild is a little frivalous.