This project is read-only.

Test results not being published

Oct 1, 2009 at 2:28 AM

I'm seeing the following error when attempting to publish my NUnit test results to TFS 2008 using v1.1 beta of NUnit4TeamBuild:

Task "Exec"
  "D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Build\Tools\NUnit4TeamBuild\v1.1b\NUnitTFS.exe" -n "D:\Source\MyProject\DailyBuild\Binaries\Debug\nunit_results.xml" -t "MyProject" -b "DailyBuild_20091001.4" -f "Debug" -p "Any CPU" -x "D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Build\Tools\NUnit4TeamBuild\v1.1b\NUnitToMSTest.xslt"
  Transforming NUnit output...
  Loading XSLT from D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Build\Tools\NUnit4TeamBuild\v1.1b\NUnitToMSTest.xslt
  Loading NUnit Output from D:\Source\MyProject\DailyBuild\Binaries\Debug\nunit_results.xml
  Writing TRX file to \\mtfssyd01\Drops\MyProject\DailyBuild_20091001.4\TestResults\07d90a01-0b11-2d00-91c4-30db1d215203\NUnitOutput.trx
  System.InvalidOperationException: PrepareToPublish failed: Publish_GeneralFailure
     at KWatkins.NUnitTfs.Publisher.PublishRun(String buildId, Guid runId) in C:\Users\Kevin Watkins\Desktop\NUnitTFS\NUnitTFS\Publisher.cs:line 63
     at KWatkins.NUnitTfs.Publisher.Publish() in C:\Users\Kevin Watkins\Desktop\NUnitTFS\NUnitTFS\Publisher.cs:line 52
     at KWatkins.NUnitTfs.Program.Main(String[] args) in C:\Users\Kevin Watkins\Desktop\NUnitTFS\NUnitTFS\Program.cs:line 19
D:\Source\MyProject\DailyBuild\BuildType\TFSBuild.proj(221,3): error MSB3073: The command ""D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Build\Tools\NUnit4TeamBuild\v1.1b\NUnitTFS.exe" -n "D:\Source\MyProject\DailyBuild\Binaries\Debug\nunit_results.xml" -t "MyProject" -b "DailyBuild_20091001.4" -f "Debug" -p "Any CPU" -x "D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Build\Tools\NUnit4TeamBuild\v1.1b\NUnitToMSTest.xslt"" exited with code 1.
Done executing task "Exec" -- FAILED.

The TestResults folder is created in the build's drop folder, but the 07d90a01-0a27-0900-91c4-30db1d215203 folder is not created, so it looks like the TeamBuild service account has the right permissions to create folders. From a quick glance at the source code, the TRX file is being uploaded to the TFS build web service, but something is going wrong during the web service call that stops the subfolder being created. Is there anything I can do to figure out what is going on?

Oct 1, 2009 at 3:16 AM

Just to clarify that, NUnit4TeamBuild is trying to upload the TRX file, but because the path returned by PrepareToPublish does not exist (due to the missing 07d90a01-0a27-0900-91c4-30db1d215203 sub-folder), the file is not uploaded. The question still remains then - how can I diagnose why TFS isn't creating the final subfolder? Or should NUnit4TeamBuild try to create that last folder if it doesn't exist?

Oct 1, 2009 at 10:14 PM

Have you successfully published before?

Can you check that you have write access via the share?  Start a command prompt as the build service account and try manually copying the trx file to the location shown in the build log and see if it gets through.

The only other thing that may have happened is that you may have a connection drop or time out during the upload of the test results or the disk may have filled.  A "general failure" is a little non-specific, and permission problems are normally reported as specific errors, so I'd suspect something at the O/S level went wrong.

Oct 1, 2009 at 11:08 PM

We were able to publish when we were playing around with our sandbox project when exploring TFS, but when we set up the for-real project, and used the same code in our TFSBuild.proj, it goes pear-shaped.

The problem is that the specified build destination doesn't exist - TFS is trying to copy the TRX file to \\mtfssyd01\Drops\MyProject\DailyBuild_20091001.4\TestResults\07d90a01-0b11-2d00-91c4-30db1d215203\, but only gets as far as creating \\mtfssyd01\Drops\MyProject\DailyBuild_20091001.4\TestResults\. I'll have a go at it from the command-line as you suggest, but do you think that there is any mileage in patching the Publisher to check that the drop folder exists before copying the file in?

Oct 1, 2009 at 11:46 PM

OK, so using runas to open a command prompt on the server, and copy a file to the TestResults folder works, as does creating a sub-folder in TestResults, so it doesn't appear to be permissions.

Does TFS log its internals anywhere?

Oct 2, 2009 at 7:09 AM

Curiouser and curiouser - I Ignored all the failing tests, and now the results are published successfully!

Oct 19, 2009 at 10:30 AM

Any chance you could give me the NUnit output for those tests? It might well be a problem with the resultant .trx file. I remember fixing a bug in it a while back where test names over a certain length (256) I think couldn't be uploaded to TFS and it failed with the wonderfully useful "General Failure"... So it's probably something in the resultant .trx that TFS doesn't like. If you can get me the NUnit output I'll have a play and see what I can do.

Aug 12, 2010 at 3:28 PM


I am getting exact same error "General Failuare"

here are some more details from event log

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 12/08/2010 14:11:47

Event time (UTC): 12/08/2010 13:11:47

Event ID: 83278f3be4a046919525a28b299be9e8

Event sequence: 9453

Event occurrence: 8

Event detail code: 0


Application information:

    Application domain: /LM/W3SVC/385180992/Root/Build-2-129259948942500000

    Trust level: Full

    Application Virtual Path: /Build

    Application Path: C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Build\

    Machine name: TFS


Process information:

    Process ID: 6836

    Process name: w3wp.exe

    Account name:\tfsservice


Exception information:

    Exception type: InvalidOperationException

    Exception message: Request format is unrecognized for URL unexpectedly ending in '/$metadata'.


Request information:

    Request URL: http://tfs:8080/Build/v1.0/PublishTestResultsBuildService2.asmx/$metadata

    Request path: /Build/v1.0/PublishTestResultsBuildService2.asmx/$metadata


Any help is appreciated



Nov 11, 2010 at 10:08 AM

If anyone of you found any solution or work-around to this problem, please let me know since I'm having the same disease!

Nov 11, 2010 at 10:13 AM

Hi Palleman

If you are getting "General Failure" try out following things

1. User account and build account have the write access to the build drop location

2. Function names in Test Dll (againt which you are running Nunit) are not more that 32 characters (they say 255 but I done beleive that)



May 31, 2011 at 12:36 PM

Hi everyone,

If someone is still struggling with the Publish_GeneralFailure error, please check the workaround suggested by Microsoft here:

Look for the reply from Johnny Coleman MSFT dated Monday, October 13, 2008 9:12 PM.


I followed the instructions and it helped me resolve two issues:

1. one that is discussed here - getting Publish_GeneralFailure when running NUnit for Team Build

2. another is with trying to publish valid MS Test results from my workstation from Visual Studio 2008 Team System Developer Edition.


Also, I can say that the cause mentioned by AmeyKarkhanis regarding long test-method names was not the case, as some tests of mine were up to 91 characters long.


I hope this helps!