[Windows 8] Building Windows Store apps using TFSServiceJanuary 3rd, 2013 | Posted by in .NET | Team Foundation Server | Windows 8 | WinJS | WinRT | Read: 3,686
The Build service is really cool because you’ll be able to build any kind of applications and, because it’s cloud-based, you won’t need to have your server running by yourself!
But, even if it’s cool, Build service on TFS Service is still in preview and so, there might be some issues. The first one is that you can’t build Windows Store apps. Indeed, if you try, you’ll encountered the following error:
At least, this is a very clear message. Fortunately, as it’s based on TFS 2012, we’ll be able to add a new Build Controller/Agent to indicate to TFS Service that we want to build Windows Store apps on a particular machine (one with Windows 8).
So, first step is to create a Windows 8 virtual machine (I won’t detailed this procedure here as it’s easy to do). Once the VM is ready, we can install all the stuff that we might need: Visual Studio 2012, Windows SDK, etc. (I know that installing VS on build machine might not be the proper way to do but, at least, it works every time).
Once the machine is ready, we’ll add a new build controller and build agent on it. For that, start the installation of Team Foundation Server 2012:
Once the installation is done, the Configuration Center is displayed on screen. Here, we won’t choose to configure Team Foundation Application Server but only the Team Foundation Build Service so select this entry and click on “Start Wizard”:
On the next screen that appears, you are asking to select the Team Project collection you are configuring build services for:
So click on the “Browse” button and add your TFS Service server:
Once authenticated, you can select the Team Project Collection that you want:
Then, you’ll be back to the previous screen, with the information dedicated to the build services for your team project collection (if you just start, you may see the same thing as the screenshot below: 0 build controller(s) and 0 build agent(s) because even if there are already a build controller/agent for TFS Service, they are is idle state until you trigger a new build):
Next, you are ask to configure the number of build controller(s)/agent(s) you want to install on the machine. For now, we’ll just install the build service so choose to configure later (we’ll do it after):
Please, note that the number of build agent(s) recommended is proposed according by your server specs (as build agents run concurrently and do processor-intensive work).
Next, you need to provide the account that will run the Build Service. You can use one of the system account but I’m not a big fan of this possibility. I prefer to create dedicated account (but feel free to do as you want for this part):
Once the readiness checks has been validated, you’re ready to configure the Build Service:
Once finish, click on “Close”:
You can now see that the Build Service is installed and configured:
Now that the service is installed, it’s time to add a controller and an agent. Launch the Team Foundation Server Administration Console from the Start Menu:
From the console, select “Build Configuration” to see that the Build Service is configured for the Team Project Collection you’ve chosen and that there is no controller(s)/agent(s):
Now, we’ll add a new controller to the Build Service. Why this is needed ? Because you cannot add/attach an on-premise build agent to a hosted build controller (the one available in TFS Service):
So click on the “New Controller…” link and add a new one:
Once the controller is up & running, we are now ready to add an agent on it so click on the link “New Agent…”:
Be sure to select the controller that you’ve just created otherwise, you’ll encountered the previous error. Also, note that I’ve added a tag. This is not necessary but when I’ll create the build definition (later), it’ll help to to be sure that only this agent will be used because this is the only one able to build Windows 8 apps
Now that controller and agent are ready, it’s the moment to create the Build definition that will use them to build Windows 8 apps:
In Visual Studio, open the Team Explorer, select “Builds” and, under “Actions”, click on “Manage Build Controllers…”:
The screen that appears display the list of all controllers/agents available for the Team Project Collection and, as you can see, the controller and agent we have created are correctly displayed (marked as Available):
Now, click on the link “New Build Definition” and fill the information needed (I won’t detailed all the screens as they are simples). the most important part is the “Build Defaults” where you have to select the controller we have installed previously and the path where the build outputs will be sent:
One the next screen (“Process”), choose the items to build but, most important (under Advanded –> Agent Settings), select the tag corresponding to the agents you want to use to perform this build:
Save the build definition then start a new build:
And voila ! :)
The build has been executed successfully and, if you look in the output/drop folder, you’ll see that the package has been deployed correctly:
Now that your build service is able to build Windows Store apps, you can keep your Virtual Machine on your own DataCenter or, thanks to Windows Azure Virtual Machine, you can upload it in Windows Azure to use it from here. The task to upload a VHD in Windows Azure is really well described here http://www.windowsazure.com/en-us/manage/windows/common-tasks/upload-a-vhd/ or here http://msdn.microsoft.com/en-us/library/windowsazure/gg465385.aspx
Once uploaded (be careful, it can take a very long time according to the VM size), follow the following steps to create a Virtual Machine from VHD (in Windows Azure): http://www.cloudtec.ch/blog/tech/create-virtual-machine-vhd-in-azure.html
Now, you don’t have any excuse to not have a real continuous integration for you Windows Store apps!