Problem – Build two projects referencing the assembly of same name but of different version fails in Team Build
Build two projects referencing the assembly of same name but of different version fails in Team Build
Scenario – Consider two projects (Proj1 and Proj2) that refer to the same assembly (lib.dll) of different versions (22.214.171.124 and 126.96.36.199). For example
$/TP1/Proj1/Proj1/Proj1.csproj (file reference to ..\..\Common\v1\lib.dll,188.8.131.52)
$/TP1/Proj2/Proj2/Proj2.csproj (file reference to ..\..\Common\v2\lib.dll,184.108.40.206)
Investigation result – This works fine on desktop scenario but is broken inside Team Build.
The user has to make sure
“Specific Version” flag is be set for the file references
User has common folder checked in at the correct location inside source control
“Private” flag (for copy local for the referenced assembly) is set to false.
The undesirable effect for the above mentioned changes is that user will not be able to run the assembly from the drop site. For example in our scenario –
Build will be successful.
At the drop site you will have binaries for proj1 and proj2.
Assemblies will not be usable because they will need lib.dll (220.127.116.11 & 18.104.22.168) at drop site but we can not have two files with same name at drop site
- If we set “Private” flag to true for proj1.csproj and proj2.csproj then also assemblies will not be usable because as part of build process for proj1.csproj, the lib.dll (22.214.171.124) will be copied to $(outdir) (binaries folder). The build for proj2.csproj will override the lib.dll (126.96.36.199). This will result in unpredictable results.
- If lib.dll (both v1 and v2) contain same methods that does different things, then assemblies for proj2 and proj1 will show wrong behavior.
- If lib.dll (both v1 and v2) contains different method signatures then application will crash.
- Avoid using file references
- If you need to use file references – different version of same assembly, then you can not run the assembly directly from the drop site and you need to have custom steps to copy the assembly to separate folder (with correct versions of referenced assemblies)