Is there a way to specify in .csproj file, to use different reference for DLL when my project is build localy and when build on TFS?
I want to share some DLLs between more solutions (do not want to copy DLLs to each solution's lib directory).
My local source structure is as follows
.\TfsProject
.\lib
MyShared.Dll
.\Solution1
.\Project1
.\Project2
.\Solution2
.\Project1
.\Project2
All Projects share relative path to MyShared.Dll
<HintPath>..\..\lib\MyShared.Dll</HintPath>
My problem arise on TFS Build server, where is source structure different from the local one.
I have tried to update .csproj files to use conditional statements, to use different HintPath
localy and on TFS build server when referencig the MyShared.Dll
. My condition is as follows
<Choose>
<!-- Local HintPath -->
<When Condition="'$(SourceDir)' == ''">
<ItemGroup>
<Reference ...>
<HintPath>..\..\lib\MyShared.Dll</HintPath>
</Reference>
</ItemGroup>
</When>
<!-- TFS Specific HintPath -->
<Otherwise>
<ItemGroup>
<Reference ...>
<HintPath>$(SourceDir)\..\_build\lib\MyShared.Dll</HintPath>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
Localy build passes, but I get The type or namespace name could not be found
error on TFS build because it cannot find MyShared.Dll
.
Any idea how can I fix this? Thanks!