{"id":5023,"date":"2012-05-29T10:00:00","date_gmt":"2012-05-29T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2012\/05\/29\/team-building-your-windows-8-metro-style-applications\/"},"modified":"2019-02-14T17:59:24","modified_gmt":"2019-02-15T01:59:24","slug":"team-building-your-windows-8-metro-style-applications","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/team-building-your-windows-8-metro-style-applications\/","title":{"rendered":"Team Building your windows 8 Metro style Applications."},"content":{"rendered":"<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Hi everyone, since this is my first blog post I&rsquo;d like to introduce myself first. My name is &ldquo;Shady Youssef Ibraheem&rdquo; and I Joined Microsoft in June 2011 working as a software development engineer in test for Visual Studio Team Foundation Server, specifically for the Team Foundation build team. I hope that readers of this blog post find it helpful as I&rsquo;m planning to publish a series of TFS Build specific posts very soon. If you have any suggestions about blog post topics regarding Team foundation Build please let me know, I&#8217;ll try to make it happen!<\/span><\/span><\/p>\n<p><span style=\"font-family: Calibri;font-size: small\">Today I&rsquo;m going to walk you through building and testing your windows 8 &ldquo;Metro Style&rdquo; applications using team foundation build 2011 express. For the purpose of this walkthrough, I will be using the <\/span><a href=\"http:\/\/windows.microsoft.com\/en-US\/windows-8\/consumer-preview\"><span style=\"font-family: Calibri;color: #0000ff;font-size: small\">Consumer preview version of win8<\/span><\/a><span style=\"font-family: Calibri;font-size: small\"> , <\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/windows\/apps\/br229516\"><span style=\"font-family: Calibri;color: #0000ff;font-size: small\">Microsoft Visual Studio 11 Express Beta for Windows 8<\/span><\/a><span style=\"font-family: Calibri;font-size: small\"> and <\/span><a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=28987\"><span style=\"font-family: Calibri;font-size: small\">Microsoft Visual Studio 11 Team Foundation Server Express Beta<\/span><\/a><span style=\"font-size: small\"><span style=\"font-family: Calibri\">. Before we begin this walkthrough, it&rsquo;s very important to understand 2 points. <\/span><\/span><\/p>\n<ol>\n<li><span style=\"color: #1f497d\"><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Windows 8 Metro Style applications will only build on a windows 8 machine. This means you can&rsquo;t reuse your already existing build machines to build metro style applications.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #1f497d\"><span style=\"font-family: Calibri;font-size: small\">The newly released <\/span><\/span><a href=\"http:\/\/blogs.msdn.com\/b\/bharry\/archive\/2012\/03\/27\/announcing-a-build-service-for-team-foundation-service.aspx\"><span style=\"font-family: Calibri;color: #0000ff;font-size: small\">team foundation build hosted service<\/span><\/a><span style=\"font-size: small\"><span style=\"color: #1f497d\"><span style=\"font-family: Calibri\"> provided to you on the team foundation service (TFS Preview) does not currently support building windows 8 metro style apps. <\/span><\/span><\/span><\/li>\n<\/ol>\n<p><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\">Step 1: Setup your development Environment:<\/span><\/span><\/b><\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Let&rsquo;s start by Opening Visual studio for the first time on a win8 machine. You&rsquo;ll notice that a window pops up prompting you to acquire a developer&rsquo;s license. While a developer&rsquo;s license is not required to create a metro style project or to build it, it&rsquo;s required for deploying your built bits. And since any metro style app is pretty much useless unless deployed then you might want to install it. The process is pretty straight forward once you provide your live ID.<\/span><\/span><\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\"><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/0878.1.png\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/05\/0878.1.png\" width=\"377\" height=\"323\" \/><\/a><\/span><\/span><\/p>\n<\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\">There&rsquo;s also a handy command line tool which can be used to check\/acquire and delete your developer license. It&rsquo;s found under &ldquo;C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDETailoredDeploy.exe&rdquo;. You can use this command line to install a developer license on your win8 build machine if you&rsquo;re using separate development\/build machines .If you need to deploy your builds for running tests during the build you might want to use this method or just open visual studio on the build machine to get the prompt above.<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">To Check if your machine already has a developer license:<\/span><\/span><\/span><\/b><\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Calibri;color: #000000\"><span style=\"font-size: small\">TailoredDeploy.exe CheckDeveloperLicense<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">To Remove your current developer license:<\/span><\/span><\/span><\/b><\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Calibri;color: #000000\"><span style=\"font-size: small\">TailoredDeploy.exe RemoveDeveloperLicense<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">To Acquire a developer license:<\/span><\/span><\/span><\/b><\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Calibri;color: #000000\"><span style=\"font-size: small\">TailoredDeploy.exe AcquireDeveloperLicense<\/span><\/span><\/p>\n<\/p>\n<p><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Step 2: Configuring your build machine:<\/span><\/span><\/span><\/b><\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Now we&rsquo;re going to configure our on-premise team foundation build server on the win8 machine&nbsp;against our Team foundation Server instance.<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Open your Team Foundation server management console and go to &ldquo;Configure Team Foundation Build Service&rdquo;.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Start the wizard.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">In the &ldquo;Project Collection&rdquo; tab, browse for your team project collection on the team foundation server your wish to configure TFS Build against.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Select how many agents to create against your controller.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Since we&rsquo;re going to be running tests during our build, and since Metro style tests need to be deployed and run inside the deployment sandbox, we need to run our build service interactively or else we will get a build error (feel free to skip this part if you&#8217;re not planning to run tests during your build).<\/span><\/span><\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000\"><span style=\"font-family: Calibri;font-size: small\">(<\/span><span> <\/span><span>Could not start tailored test run because Unit tests for Windows Metro style app cannot be run from a service or non interactive process. Please run unit tests from an interactive process.)<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri;font-size: small\">Continue with the wizard (more information <\/span><\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ee259687(v=vs.110).aspx\"><span style=\"font-family: Calibri;color: #0000ff;font-size: small\">here<\/span><\/a><span style=\"color: #1f497d\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">)<span style=\"color: #000000\">.<\/span><\/span><\/span><\/span><\/li>\n<\/ul>\n<p><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Step 3: Creating and checking in your Metro style project:<\/span><\/span><\/span><\/b><\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Now you&rsquo;re ready to create your win8 metro style project and add it to source control. Notice that Team Explorer is not shown by default in the express SKU so you&rsquo;ll need to connect to your server via TeamConnect to Team Foundation Server&hellip;&nbsp; You&rsquo;ll then connect normally to your TFS server. You then create and edit your metro style project and check it into your Team Foundation Server&rsquo;s version control repository. I&rsquo;m using a solution that contains a c# Windows Metro Style Split Application project and a Metro Style Unit test project but feel free to experiment with other types of projects, who knows maybe your little test project there ends up being the newest hit app \ud83d\ude09 <\/span><\/span><\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Notice that, by default newly created projects will have an exportable .pfx file (highlighted in red below). Those pfx files have an empty password by default but you can go on and change them. For this walkthrough we&rsquo;re just going to leave them as is. Those pfx files are required for deploying your metro style projects and must be installed on the machine where your project will be deployed. Since we are planning to run tests during our build (which requires deployment as I mentioned earlier), we&rsquo;ll need to manually install the certificates on the build machines running our build. If you&rsquo;re only interested in building the app, then you can safely skip installing the certificates.<\/span><\/span><\/p>\n<p><span style=\"font-family: Calibri\"><span style=\"font-size: small\"><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/8422.2.png\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/05\/8422.2.png\" width=\"288\" height=\"543\" \/><\/a><\/span><\/span><\/p>\n<\/p>\n<ul>\n<li><span style=\"color: #000000\"><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Installing the certificates on the build machine:<\/span><\/span><\/span><\/b> <\/span>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Copy the 2 certificates on the machines that have the agents building your app.<\/span><\/span> <\/span>\n<ul>\n<li><span style=\"color: #000000\">&nbsp;<span style=\"font-family: Calibri\"><span style=\"font-size: small\">Use the following command for every certificate you&rsquo;re going to install where {***.pfx} is the path to that specific pfx file.<\/span><\/span><\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Certutil &ndash;importpfx {***.pfx}<\/span><\/span><\/span><\/p>\n<p><span style=\"font-family: Calibri;color: #000000\"><span style=\"font-size: small\">Now go ahead, do the changes you want to your app and check your code in (make sure you add at least a test case to the test solution).<\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><b><span style=\"text-decoration: underline\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Step 3: Create your build definition:<\/span><\/span><\/span><\/b><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Open your team explorer and then go to the Builds hub<\/span><\/span><\/span><\/li>\n<\/ul>\n<p><span style=\"color: #1f497d\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\"><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/8358.3.png\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/05\/8358.3.png\" width=\"214\" height=\"384\" \/><\/a><\/span><\/span><\/span><\/p>\n<\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Create a new build definition<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Fill in all the tabs as normal then open the process tab<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">We&rsquo;re going to be using the default build template which should be selected by default.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\"><span style=\"font-family: Calibri\">In the items to build process parameter field, browse your version control repository for the .sln file you want to build. (If you have the solution open in solution explorer it will be selected by default <\/span>J<span style=\"font-family: Calibri\"> .<\/span><\/span><\/span><\/li>\n<li><span><span><span><span style=\"font-family: Calibri;font-size: x-small\">Now for the tricky part, to run tests using the default template, we&rsquo;re used to specifying a wild card that will run all tests in sources matching the pattern &ldquo;***test*.dll&rdquo;. <\/span><b style=\"color: #000000;font-family: Calibri;font-size: small\">For Metro style tests this will not work. <\/b><span style=\"font-family: Calibri;font-size: x-small\">This is because like all metro style apps, test apps are packaged in the win8 package format that ends with *.appx. This means that we should either not use wildcards (IE: use the full names of expected test packages generated) or change the wildcard to &ldquo;***test*.appx&rdquo;.<b><\/b><\/span><\/span><\/span><\/span><\/li>\n<ul>\n<li><span style=\"color: #000000\">&nbsp;<span style=\"font-family: Calibri\"><span style=\"font-size: small\">In the process tab, under basic. Select the Ellipsis to open the settings for &ldquo;Automated Tests&rdquo;.<\/span><\/span><\/span><\/li>\n<\/ul>\n<\/ul>\n<p><span style=\"color: #1f497d\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\"><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/5758.4a.png\"><\/a><\/span><\/span><\/span><\/p>\n<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/5850.7.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/05\/5850.7.png\" border=\"0\" alt=\"\" \/><\/a><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/8311.7.png\"><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/8311.7.png\"><\/a><\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Edit &#8230;<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Make sure you&rsquo;re using Visual Studio Test Runner.<\/span><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\">Make sure you change the Test assembly file specification to &ldquo;***test*.appx&rdquo;.<\/span><\/span><\/span><\/li>\n<\/ul>\n<p><span style=\"color: #1f497d\"><span style=\"font-family: Calibri\"><span style=\"font-size: small\"><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/5125.5.png\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/05\/5125.5.png\" width=\"298\" height=\"364\" \/><\/a><\/span><\/span><\/span><\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Save your build definition.<\/span><\/span><\/span><\/li>\n<\/ul>\n<p><b><span style=\"text-decoration: underline\"><span style=\"font-size: small\"><span style=\"font-family: Calibri\">Conclusion:<\/span><\/span><\/span><\/b><\/p>\n<p><span style=\"font-size: small\"><span style=\"font-family: Calibri\">We walked through the process of automating your builds of windows 8 Metro Style apps using Team Foundation Server 2011 Build. We saw how to create build definitions and we reviewed the required steps for running Metro Style Unit tests on our apps as a part of the build.&nbsp; If you have any questions\/feedback please don&rsquo;t hesitate to ask.<\/span><\/span><\/p>\n<\/p>\n<p><b><span style=\"text-decoration: underline\"><span style=\"font-size: small\"><span style=\"font-family: Calibri\">References:<\/span><\/span><\/span><\/b><\/p>\n<ul>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh691189(v=VS.110).aspx\"><span style=\"font-family: Calibri;color: #0000ff;font-size: small\">http:\/\/msdn.microsoft.com\/en-us\/library\/hh691189(v=VS.110).aspx<\/span><\/a><b><span style=\"text-decoration: underline\"><\/span><\/b><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, since this is my first blog post I&rsquo;d like to introduce myself first. My name is &ldquo;Shady Youssef Ibraheem&rdquo; and I Joined Microsoft in June 2011 working as a software development engineer in test for Visual Studio Team Foundation Server, specifically for the Team Foundation build team. I hope that readers of this [&hellip;]<\/p>\n","protected":false},"author":113,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"acf":[],"blog_post_summary":"<p>Hi everyone, since this is my first blog post I&rsquo;d like to introduce myself first. My name is &ldquo;Shady Youssef Ibraheem&rdquo; and I Joined Microsoft in June 2011 working as a software development engineer in test for Visual Studio Team Foundation Server, specifically for the Team Foundation build team. I hope that readers of this [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/5023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=5023"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/5023\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=5023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=5023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=5023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}