MSBuild.ExtensionPack.Tfs.TeamBuild: "NullReferenceException: Object reference not set to an instance of an object."

Nov 10, 2010 at 6:30 PM
Edited Nov 10, 2010 at 6:31 PM

Mike,

I am having an issue using the TeamBuild Task with TFS 2010. I have clawed through quite a few issues of my own in this process so far, but this one has be stuck. I am getting the following on build:

"C:\Builds\4\XXXXXXXX\XXXXXXXX - DEV1 - On Source Commit\BuildType\TFSBuild.proj (63): NullReferenceException: Object reference not set to an instance of an object.
 TF270015: 'MSBuild.exe' returned an unexpected exit code. Expected '0'; actual '1'."

I have been all over the web looking for answers and it seem that there are other people using your tasks to perform what I am trying too, so I am not sure where I am going wrong.
I have followed suggestions that I needed to add the path to tf.exe to my PATH environment variable, I have done everything that I can think of, please assist, haha!

Attached is the fragment from my .proj that you should care about:

1)  <TeamFoundationServerUrl>http://cntr1-p-tfs1:8080</TeamFoundationServerUrl>
    <TeamProject>XXXXXXXX</TeamProject>
    <BuildUri>/tfs/projects/</BuildUri>
    <BuildDefinitionName></BuildDefinitionName>

2)  <Target Name="AfterDropBuild">

    <!-- Get information on the latest build -->
 
    IT IS FAILING ON THE NEXT LINE
    <MSBuild.ExtensionPack.Tfs.TeamBuild TaskAction="GetLatest" TeamFoundationServerUrl="$(TeamFoundationServerUrl)" TeamProject="$(TeamProject)" BuildUri="$(BuildUri)">
      <Output ItemName="BuildInfo" TaskParameter="Info"/>
    </MSBuild.ExtensionPack.Tfs.TeamBuild>
 
    <Message Text="BuildAgentDirectory: %(BuildInfo.BuildAgentDirectory)"/>
    <Message Text="BuildAgentBuildServerVersion: %(BuildInfo.BuildAgentBuildServerVersion)"/>
    <Message Text="BuildAgentDescription: %(BuildInfo.BuildAgentDescription)"/>
    <Message Text="BuildAgentFullPath: %(BuildInfo.BuildAgentFullPath)"/>
    <Message Text="BuildAgentMachineName: %(BuildInfo.BuildAgentMachineName)"/>
    <Message Text="BuildAgentMaxProcesses: %(BuildInfo.BuildAgentMaxProcesses)"/>
    <Message Text="BuildAgentName: %(BuildInfo.BuildAgentName)"/>
    <Message Text="BuildAgentPort: %(BuildInfo.BuildAgentPort)"/>
    <Message Text="BuildAgentUri: %(BuildInfo.BuildAgentUri)"/>
    <Message Text="BuildDefinitionUri: %(BuildInfo.BuildDefinitionUri)"/>
    <Message Text="BuildFinished: %(BuildInfo.BuildFinished)"/>
    <Message Text="BuildNumber: %(BuildInfo.BuildNumber)"/>
    <Message Text="BuildUri: %(BuildInfo.BuildUri)"/>
    <Message Text="CompilationStatus: %(BuildInfo.CompilationStatus)"/>
    <Message Text="CompilationSuccess: %(BuildInfo.CompilationSuccess)"/>
    <Message Text="ConfigurationFolderPath: %(BuildInfo.ConfigurationFolderPath)"/>
    <Message Text="ConfigurationFolderUri: %(BuildInfo.ConfigurationFolderUri)"/>
    <Message Text="DropLocation: %(BuildInfo.DropLocation)"/>
    <Message Text="FinishTime: %(BuildInfo.FinishTime)"/>
    <Message Text="KeepForever: %(BuildInfo.KeepForever)"/>
    <Message Text="LabelName: %(BuildInfo.LabelName)"/>
    <Message Text="LastChangedBy: %(BuildInfo.LastChangedBy)"/>
    <Message Text="LastChangedOn: %(BuildInfo.LastChangedOn)"/>
    <Message Text="LogLocation: %(BuildInfo.LogLocation)"/>
    <Message Text="Quality: %(BuildInfo.Quality)"/>
    <Message Text="Reason: %(BuildInfo.Reason)"/>
    <Message Text="RequestedBy: %(BuildInfo.RequestedBy)"/>
    <Message Text="RequestedFor: %(BuildInfo.RequestedFor)"/>
    <Message Text="SourceGetVersion: %(BuildInfo.SourceGetVersion)"/>
    <Message Text="StartTime: %(BuildInfo.StartTime)"/>
    <Message Text="TestStatus: %(BuildInfo.TestStatus)"/>
    <Message Text="TestSuccess: %(BuildInfo.TestSuccess)"/>
 
    <MSBuild.ExtensionPack.Tfs.TeamBuild TaskAction="RelatedChangesets" TeamFoundationServerUrl="$(TeamFoundationServerUrl)" TeamProject="$(TeamProject)" BuildUri="$(BuildUri)" BuildDefinitionName="$(BuildDefinitionName)">
      <Output ItemName="Changesets" TaskParameter="RelatedItems"/>
    </MSBuild.ExtensionPack.Tfs.TeamBuild>
    <Message Text="ID = %(Changesets.Identity), Checked In By = %(Changesets.CheckedInBy), URI = %(Changesets.ChangesetUri), Comment = %(Changesets.Comment)"/>
 
  </Target>


Please let me know what you think and if you can assist or if I need to provide more information.

Thanks,
Ryan

Coordinator
Nov 11, 2010 at 10:30 AM

Hi Ryan, this was recently fixed with http://msbuildextensionpack.codeplex.com/SourceControl/changeset/changes/57082

Can you compile the latest code: http://msbuildextensionpack.codeplex.com/wikipage?title=DevelopingLatest&referringTitle=Documentation

Let me know if that resolves it for you.

Thanks

Mike

Nov 11, 2010 at 1:47 PM

Mike,

Download ... Compile ... (Add SNK Verification) ... BAM!

Excellent, it finally works!!!! I appreciate the quick turn around, you really saved me some time.

Thanks
Ryan