Some general information on what needs to be done on a Microsoft TFS server so K2 projects can be automatically compiled and built.
Before You Begin
This is not a full guideline and additional guidance can be found on K2 Centre of Excellence - https://coe.k2.com
In TFS you can select which server will be your build server. On this server you have to download and run a build agent. This is a simple script file which can run in any environment (Windows, Linux, etc), and will then know what to do with the build.
For our (K2) purposes you have to either have an existing build server that has the K2 client tools installed so that it can build the K2 solution, or you have to configure that TFS build to use the build agent on the K2 dev server. There are other options as well, but in an enterprise environment option 1 with a dedicated build server seems to be the most widely used.
Please note that if you are using TFS online (not on-premise) then you might be using the built-in TFS online elastic build service. That means the build is being executed somewhere inside the TFS cloud. For K2 that will obviously not work because you need the K2 client tools to run the build. So then you would have to go back to the option of having a build server or K2 server somewhere that runs the build agent. The nice thing about this internal build server is that it does not need an incoming network connection from TFS to it – all it needs is an internet connection that can connect to TFS online and the build agent will do its job.
All in all this is quite technically involved and mostly related to TFS which is not a K2 support topic, so ideally Professional Services is needed if you need additional assistance with the TFS configuration.