Build/Test Issues

Assemblies are being referenced from the build output directory of other projects in this solution

Started by sferencik on 6,957 views

I've upgraded from RhinoMocks 3.0.1 to RhinoMocks 3.6.0 and started getting this warning:

QattHarnessTests: Assemblies are being referenced from the build output directory of other projects in this solution
...
The following assembly references have triggered this warning:
C:\p4_ws\ferencis_tt\dev\test\HarnessTests\bin\x86\Debug\Rhino.Mocks.dll


I have read Remco's explanation of this in another forum post. As proposed in that post, I have built the project from the command-line:
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe .\QattHarnessTests.csproj /v:d


but nothing in the output of that build gives me a hint of what's wrong.

The project is QattHarnessTests.csproj and the HintPath for RhinoMocks is correct, i.e. it is an absolute path pointing outside of any build-output directory. (c:\p4_ws\ThirdParty\vc8-win32\RhinoMocks-3.6.0\Rhino.Mocks.dll). Does the warning message mean that QattHarnessTests is ignoring the HintPath and instead referencing RhinoMocks from the build-output directory (C:\p4_ws\ferencis_tt\dev\test\HarnessTests\bin\x86\Debug\Rhino.Mocks.dll)? I can't see anything in the output of MSBuild that suggests this.

I can share the output of MSBuild; what's the best way to share an 800k file here?

Thanks,
Sam
Hi Sam,

MSBuild is a strange beast. If you are seeing this warning, then MSBuild is resolving the reference from the wrong path. This is a common problem when upgrading referenced assemblies that are still being referenced by projects in your solution under their previous version. For example, you may have a project in your solution that is referencing v3.0.1 of RhinoMocks (even though the hint path may point to 3.6.0). MSBuild will follow any number of implicit paths to find the assembly it wants - and in this case is finding it in the build output directory of one of the other projects in your solution.

The best way to resolve this problem is to clean your solution out entirely. Delete all build outputs from all projects, then rebuild your solution from scratch. If all is well, you should start to see build errors appear that alert you to the true problem here. MSBuild is masking a resolution issue with implicit logic.

Generally with the /v:d switch, MSBuild will output referencing information for each assembly reference it resolves during the build process, i.e:

Primary reference "nunit.framework, Version=2.6.1.12217, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77".
Resolved file path is "C:\Temp\nunit.framework.dll".
Reference found at search path location "{HintPathFromItem}".
The ImageRuntimeVersion for this reference is "v2.0.50727".

Because the output is large, you'll probably need to dump it to file to see the entire thing (i.e. msbuild /v:d > output.txt)

But in all honesty, troubleshooting the issue with MSBuild output is probably the hard way to solve this problem. The easiest way is to simply remove ALL possible chances for MSBuild to execute the implicit logic (i.e. by clearing out all offending assemblies), then observing the hard facts in the error output.
I do have it in a file (the 800k one I mentioned) but it seems to be doing the right thing:

Primary reference "Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f".
Resolved file path is "c:\p4_ws\ThirdParty\vc8-win32\RhinoMocks-3.6.0\Rhino.Mocks.dll".
Reference found at search path location "{HintPathFromItem}".
Found related file "c:\p4_ws\ThirdParty\vc8-win32\RhinoMocks-3.6.0\Rhino.Mocks.xml".

Anyway, will clean the build output and see where I get. Thanks.
Remco,

Yes, it worked; thanks.

This is probably the best-supported third-party product I've ever worked with. (That includes the forum, the email comms, and the online documentation.)

Thanks,
Sam
Thanks Sam! Great to hear and I'm glad you're enjoying the product!


Cheers,

Remco

Post a reply

Log in to reply.