{"id":561,"date":"2015-07-07T01:36:19","date_gmt":"2015-07-06T20:06:19","guid":{"rendered":"http:\/\/techtwaddle.net\/?p=561"},"modified":"2015-07-07T01:45:14","modified_gmt":"2015-07-06T20:15:14","slug":"setting-up-an-on-premise-build-agent-with-visual-studio-online","status":"publish","type":"post","link":"https:\/\/techtwaddle.co.in\/blog\/2015\/07\/07\/setting-up-an-on-premise-build-agent-with-visual-studio-online\/","title":{"rendered":"Setting up an on premise build agent with Visual Studio Online"},"content":{"rendered":"<p>In this post we\u2019ll look at how to configure an on-premise build agent to work with your visual studio online account. If you haven\u2019t given Visual Studio Online a try yet, I suggest you head over to <a title=\"https:\/\/www.visualstudio.com\/\" href=\"https:\/\/www.visualstudio.com\/\">https:\/\/www.visualstudio.com\/<\/a>, sign-in using your Microsoft account, create a free VSO account and take it for a spin! If you\u2019re new to VSO, these <a href=\"https:\/\/channel9.msdn.com\/Series\/Visual-Studio-Online\">channel9 videos<\/a> should help get you up to speed.<\/p>\n<p><strong>Create a team project and add sample code<\/strong><\/p>\n<p>For our purposes here, we\u2019ll create a new team project and add a simple Windows Forms application to it and set up the build agent to build this project. After you log into VSO, select the \u2018new\u2019 link from under \u2018Recent projects and teams\u2019 section to create a new team project. I selected Agile process template and git as the underlying version control, but these aren\u2019t necessary for our discussion here, you can try out other combinations as well.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image13.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb13.png\" width=\"470\" height=\"447\" \/><\/a> <\/p>\n<p>Navigate to the newly created team project and select \u2018Open with Visual Studio\u2019. This should launch Visual Studio and might ask you for credentials to connect to VSO. Clone the repository and add a new solution to the repo, commit the changes and push them to the server. The project should now show up in the VSO portal.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image17.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb17.png\" width=\"650\" height=\"244\" \/><\/a><\/p>\n<p>&#160;<\/p>\n<p><strong>Configuring the build agent<\/strong><\/p>\n<p>For the demo here, I\u2019ll be using my trusty Lenovo ThinkPad as the build agent. Log into your VSO account and select the gear icon on top right of the screen to go into your account settings. Click on \u2018Control Panel\u2019 and select \u2018Agent Pools\u2019. <a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image2.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb2.png\" width=\"590\" height=\"358\" \/><\/a> <\/p>\n<p>Click on \u2018Download agent\u2019 to download the VSO agent binaries and the scripts to configure the agent. Save <em>agent.zip<\/em> to your favorite location on the disk and extract it (for e.g. to c:\\agent). You might need to unblock the zip file before extracting it, just right click on the zip file, select properties and check the \u2018unblock\u2019 box. The zip file contains the binaries for the build agent and also a powershell script, ConfigureAgent.ps1, which will help you setup the machine as a build agent.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image3.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb3.png\" width=\"367\" height=\"229\" \/><\/a> <\/p>\n<p>Open a powershell prompt and navigate to c:\\agent and run <em>ConfigureAgent.ps1<\/em>. This will launch a command prompt window and ask you details about the agent, here\u2019s what to select:<\/p>\n<p><strong>Name for this agent<\/strong>: leave as default or give a fancy name<\/p>\n<p><strong>URL for the Team Foundation Server<\/strong>: your VSO account URL (in my case this was <a href=\"https:\/\/pkumalive.visualstudio.com\">https:\/\/pkumalive.visualstudio.com<\/a>)<\/p>\n<p><strong>Configure this agent against which agent pool?<\/strong>: default<\/p>\n<p><strong>Work folder path<\/strong>: leave as default<\/p>\n<p><strong>Install the agent as Windows Service<\/strong>: Y<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image18.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb18.png\" width=\"661\" height=\"351\" \/><\/a> <\/p>\n<p>Your build agent is now setup and if you go to the account settings and refresh the agent pool, you should see the new agent listed under the default pool.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image19.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb19.png\" width=\"414\" height=\"301\" \/><\/a> <\/p>\n<p>And that\u2019s it! The build agent is now ready, we just need to create a build definition which will use this agent to build our project.<\/p>\n<p><em>Note: The last step in the build agent setup, install as windows service, is optional. But I couldn\u2019t get the project to build if the agent isn\u2019t installed as a windows service. I will investigate this and update later.<\/em><\/p>\n<p><strong>Create a build definition<\/strong><\/p>\n<p>Go to the Build tab of your team project and click on + to create a new build definition. You can start from an empty build definition; add the \u2018MSBuild\u2019 task to the definition, browse and select the solution you want to build.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image20.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb20.png\" width=\"675\" height=\"358\" \/><\/a> <\/p>\n<p>Under the \u2018general\u2019 tab, choose the default queue. Remember this is what we used while creating the build agent.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image21.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb21.png\" width=\"531\" height=\"349\" \/><\/a> <\/p>\n<p>Give the build definition a name and save it. Select \u2018Queue build\u2026\u201d after this to trigger a build. Within few seconds you should see the build being run. If you want to publish the build artifacts to a file share or any other location, you can add another task to the build definition \u2018Publish build artifacts\u2019, and set it up accordingly.<\/p>\n<p><a href=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image22.png\"><img decoding=\"async\" loading=\"lazy\" title=\"image\" style=\"border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline\" border=\"0\" alt=\"image\" src=\"https:\/\/www.techtwaddle.co.in\/blog\/wp-content\/uploads\/2015\/07\/image_thumb22.png\" width=\"654\" height=\"358\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post we\u2019ll look at how to configure an on-premise build agent to work with your visual studio online account. If you haven\u2019t given Visual Studio Online a try yet, I suggest you head over to https:\/\/www.visualstudio.com\/, sign-in using your Microsoft account, create a free VSO account and take it for a spin! If &hellip; <a href=\"https:\/\/techtwaddle.co.in\/blog\/2015\/07\/07\/setting-up-an-on-premise-build-agent-with-visual-studio-online\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Setting up an on premise build agent with Visual Studio Online<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[6],"tags":[20],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1ktFF-93","_links":{"self":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/561"}],"collection":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":4,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":593,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions\/593"}],"wp:attachment":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}