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: -
<Target Name="ResolveTestReferences" Condition="'@(Shadow)'!=''"> <BuildShadowTask ExecuteAsTool="True" <!—Default value is false, change it to true –> CurrentResolvedReferences="@(ReferencePath)" CurrentCopyLocalFiles="@(ReferenceCopyLocalPaths)" Shadows="@(Shadow)" ProjectPath="$(ProjectDir)" IntermediatePath="$(IntermediateOutputPath)" SignAssembly="$(SignAssembly)" KeyFile="$(AssemblyOriginatorKeyFile)" DelaySign="$(DelaySign)"> <Output TaskParameter="FixedUpReferences" ItemName="ReferencePath"/> <Output TaskParameter="NewCopyLocalAssemblies" ItemName="ReferenceCopyLocalPaths"/> </BuildShadowTask> </Target>