Search code examples
c#msbuildvisual-studio-2015tfsbuildazure-devops

How to add a folder to searchpaths in VSO 2015 build server


I am having problems with a build server that I am trying to set up. We use telerik, and have installed the libraries with the telerik control panel. The build process searches for the dll's all the wrong places.

Needless to say that the solutions builds perfectly on developer maschines.

The solution contains many projects, and not a single main project. I really do not want to have to change all the proj-files.

What I want is to add the telerik directory to AssemblySearchPaths, but using the msbuild parameters from the gui only got me to overwrite the AssemblySearchPath - with the result that the location of everything else but telerik files became unknown to build.

So I located a .targets file, which I read in the logfiles were utilized by build to set AssemblySearchPaths. And adding the telerik directory here did the trick (alas I still cannot get the build server to find the nuget dll's but that is another story).

However, I see that depending on selected CPU and perhaps other circumstances, the build uses another similar named .targets file from another location. Also, I find it less than optimal that such crutial customization is hidden away in a automatically installed file somewhere obscure.

So the question is: how to add more searchpaths to the ones already defined by the framework?

I am somewhat unfamiliar with ms build, but I did see an full fledged ms build file once which is why I knew it defines the build searh paths. However; alternatives which does not require that I change the projects in the solution will work for me.

Thanks!


Solution

  • Firstly, you need to be clear that: when you queue a build in VSO, the queued build is running on the Hosted Build Server. However, the software environment is different than developer machines, that is the reason why you can build successfully on developer machine but not on hosted build server.

    If you would like, one easier way to resolve your issue is to set up the developer machine as the build server. You can register that developer machine with VSO, then all builds will run directly on the developer machine. Check this MSDN article for the details on how to set up build controller: https://msdn.microsoft.com/library/ee330987.aspx

    If you don't like to set up the on-premise build server for VSO, you need to use Nuget restore function to resolve the assembly reference issue, because as far as I can tell configuring AssemblySearchPaths is not so convenient. Please check link for the details on how to have NuGet packages restored during the VSO (TFS) build process: http://docs.nuget.org/consume/package-restore/team-build