How to force MsBuild to use existed dll?
I have folloving (simplified) definition in csproj file:
<Choose><When Condition=" '$(CCNetBuildId)' == '' AND '$(BatchBuild)' == '' "><ItemGroup><ProjectReference Include="..\GPS.Order.Factory\GPS.Order.Factory.csproj"><Project>{f3cd6b63-0312-4708-9c99-18232a20d21e}</Project><Name>GPS.Order.Factory</Name></ProjectReference></ItemGroup></When><When Condition=" '$(BatchBuild)' == 'true' "><ItemGroup><Reference Include="GPS.Order.Factory"><SpecificVersion>False</SpecificVersion><HintPath>GPS.Order.Factory.dll</HintPath><Private>False</Private></Reference> </ItemGroup></When><Otherwise><ItemGroup><Reference Include="GPS.Order.Factory" /></ItemGroup></Otherwise></Choose>
Idea was - when I use a standard Studio build (not CruiseControl or my own batch file) will be compiled
GPS.Order.Factory.csproj
if I use batch build - will be used dll in working folder.
In any other case (CruiseControl build) will be used any suitable (most likely - from working folder) instance of dll.
If something goes wrong - an error report expected.
But behavioure of MsBuild are different from expected.
On batch and CC builds MsBuild picked up DLL from OBJ folder of Gps.Order.Factory.csproj. Usually there are wrong DLL.
How do I suppress picking up wrong DLL?
I rememeber that I already do ask something similar when Studio 2015 was released and problem was confirmed.
But looks like the problem remain on place.
Sincerely, Highly skilled coding monkey.