Class1(14,27): error CS0234: The type or namespace name 'Class1' does not exist in the namespace 'namespace1' (are you missing an assembly reference?)
Tried the same build in the original Build agent and it did built without any problems. Ran the build again with diagnostics log. From the log files I spotted that where my project was getting compiled using Csc.exe , it didn’t include reference to a project. So, I checked again where the project being reference was getting built and yes it was. Also, it was built before the project what was referencing it. So on the face of it everything looked good. But it won’t still build!
Next thing was to try building the solution manually using MSBUILD. So wrote something like
Msbuild.exe mysolution.slnIt ran successfully without a hitch. Now, it was getting interesting. But hang on Team Build does use Multi-processor support while invoking msbuild. So, ran msbuild again with a /m switch
Msbuild.exe /m mysolution.sln
Here we go, I got exactly the same problem. So the build work fines when someone is compiling using one processor but not with multi-processor. So, what happened there?
With some support from Microsoft Visual Studio support team, found that it could be a problem that that path of the project file was too long. So looked back and yes it was. The path of the project that the other project was referencing was 262 characters. Reduced the path length by reconfiguring my build agent to build on a shorter named base directory and bang it worked correctly.
So, if you hit by this problem that a build doesn’t work when maxcpucount is greater than one, do check your path lengths.