I have seen customers running into this problem once in a while where they mention that their build is failing intermittently with the following error.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamTest\Microsoft.TeamTest.targets (14): Object reference not set to an instance of an object.
Here is what I typically suggest to those customers.
This error is observed during the compilation of those test projects which uses “private accessors” to test the private functions. If you stop using the private accessor functionality (recommended), then you don’t run into this problem. The private accesors feature was deprecated in VS 2010 as mentioned here and we are strongly recommending our users to use the alternate approaches suggested here to test their private functions.
But if due to any reason, you cannot remove the usage of private accessors immediately from your tests, please try changing the TeamTest targets file ("C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamTest\Microsoft.TeamTest.targets") and see whether running the shadow task in a separate process works or not.
Here are the steps you should do for this: –
- Edit the targets file ‘C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamTest\Microsoft.TeamTest.targets’.
- Change ExecuteAsTool property (highlighted) from default false to true.
- Save the file. (and probably restart the machine as well so that the background msbuild processes definitely picks up the change)
<Target Name="ResolveTestReferences" Condition="’@(Shadow)’!=”">
ExecuteAsTool="True" <!—Default value is false, change it to true –>
<Output TaskParameter="FixedUpReferences" ItemName="ReferencePath"/>
<Output TaskParameter="NewCopyLocalAssemblies" ItemName="ReferenceCopyLocalPaths"/>