I know that I can add a HintPath to an external DLLs to help Visual Studio/TFS find the dll when it builds.
What I was wondering is... is it possible to add multiple HintPath?
For example... developers have their DLLs for one place and we do a GetLatest of those DLLs at a different place on the server hence the need for multiple HintPath.
What do you think, world?
Sorry, you can't use multiple HintPath's. Visual Studio/MSBuild takes only the last
<HintPath>
definition and will ignore any previous ones. Confirmed in VS2010 and VS2012.Using Condition you can:
The last HintPath where the Condition evaluates to true will be used.
Add the following to the bottom of your project file just after the commented out targets section:
Replacing
YOUR_FIRST_PATH
andYOUR_SECOND_PATH
with your paths.It's important this goes after the following line or your setting will be overwritten:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
With the
$(AssemblySearchPaths)
entry at the end of the string DLLs in your paths will override the normal resolution. If you move it to the beginning then the normal resolution is tried first and the additional paths are checked for any that weren't found. Normal resolution includes<HintPath>
sections so there is no need to remove them if your paths come first.This answer is no longer valid. As Sardaukar's comment says, Visual Studio always blindly uses the last HintPath. Alex's answer supports this.
Alright. I'm faster than Stackoverflow this time. I tried to add it and it seems to work fine.
So multiple HintPath IS possible.
When you have this:
You can simply add more hint path like that:
You can use environment variables for that. E.g.