user1698744
user1698744

Reputation: 71

TFS 2012 build error The "CreateWorkspaceTask" task was not given a value for the required parameter "BuildAgentUri"

We upgraded to TFS 2012 and changed our legacy build templates to remove all strong name references to Microsoft.TeamFoundation namespaces from the Activity element. We are now getting the following error when building:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets (801): The "CreateWorkspaceTask" task was not given a value for the required parameter "BuildAgentUri".

Has anyone else encountered this error?

Upvotes: 7

Views: 3072

Answers (2)

BubbleSort
BubbleSort

Reputation: 1539

We ran into this same issue on one of our build machines. The build machine was working fine one day and stopped the next. The only change was finishing the installation of Service Pack 1 for Visual Studio 2010.

We figured that possibly MSBuild got rolled to a previous version.

So we looked at this file on another build machine and that section looked exactly like the snippet Chev provided.

So we went into "progams and features" on the build machine and did a Repair on the TFS 2012 installation. That updated the Microsoft.TeamFoundation.Build.targets file to look just like the snippet provided by Chev.

Now the builds run correctly again.

Upvotes: 6

Chev
Chev

Reputation: 121

I just resolved this issue earlier today....

Navigate and open:-

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets

Find the section resembling the following:-

CreateWorkspaceTask TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" BuildDirectory="$(BuildDirectory)" SourcesDirectory="$(SolutionRoot)" Name="$(WorkspaceName)" Comment="$(CreateWorkspaceTaskComment)"

Replace it with:-

<!-- Create the workspace for this build -->
    <CreateWorkspaceTask
          TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
          BuildUri="$(BuildUri)"
          BuildDirectory="$(BuildDirectory)"
          SourcesDirectory="$(SolutionRoot)"
          Name="$(WorkspaceName)"
          Comment="$(CreateWorkspaceTaskComment)"
          Condition=" '$(ProjectFileVersion)' != '4'">
      <Output TaskParameter="Name" PropertyName="WorkspaceName" />
      <Output TaskParameter="Owner" PropertyName="WorkspaceOwner" />
    </CreateWorkspaceTask>
    <CreateWorkspaceTask
          TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
          BuildUri="$(BuildUri)"
          BuildDirectory="$(BuildDirectory)"
          BuildAgentUri="$(BuildAgentUri)"
          SourcesDirectory="$(SolutionRoot)"
          Name="$(WorkspaceName)"
          Comment="$(CreateWorkspaceTaskComment)"
          Condition=" '$(ProjectFileVersion)' == '4'">
      <Output TaskParameter="Name" PropertyName="WorkspaceName" />
      <Output TaskParameter="Owner" PropertyName="WorkspaceOwner" />
    </CreateWorkspaceTask>

Please pay special attention to the casing of the text as this is an XML document...

Please let me know if this helps...

Cheers!

... Chev

Upvotes: 12

Related Questions