1. Configure an on-premises system with TFS 2013 Update 2. Only install Build Server and connect it to your VSO repository.
  2. Install the software needed to build (like Winrar, reshack, etc).
  3. See http://blogs.msdn.com/b/aaronhallberg/archive/2008/07/28/a-minimal-tfsbuild-proj-file.aspx

This allows you to use the existing build scripts.

Use the following links to create a custom build activity: http://msdn.microsoft.com/en-us/library/dd647551.aspx. You can use C#, although the article says you should create a VB project.