<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>If broken it is, fix it you should</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/tess/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/tess/feed.xml</link>
    <description>@TessFerrandez</description>
    <lastBuildDate>Sun, 17 Mar 2019 10:01:04 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Mastering ASP.NET 5 without growing a beard</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/mastering-asp-net-5-without-growing-a-beard</link>
      <pubDate>Thu, 12 Nov 2015 06:44:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2015/11/12/mastering-asp-net-5-without-growing-a-beard/</guid>
      <description><![CDATA[&hellip;or learn the lingo and sound like an ASP.NET 5 expert
So you know ASP.NET like the back of...]]></description>
      <content:encoded><![CDATA[<p>&hellip;or learn the lingo and sound like an ASP.NET 5 expert</p>
<p>So you know ASP.NET like the back of your hand, or so you think, until you hear grunt this, and bower that, and you realize that nothing has changed but EVERYTHING, and all you can do is just sit there and nod like Joey in friends.</p>
<p>If you don&rsquo;t have time to grow a beard, or go through the <a href="https://mva.microsoft.com/en-US/training-courses/introduction-to-asp-net-5-13786">Intro to ASP.NET 5 course</a>, but still want to hang out with the cool guys, here is the cliff notes version. Just enough to be conversational.</p>
<h3>5 quick facts about ASP.NET 5</h3>
<p>In short, what has happened with ASP.NET 5 is that it is a new incarnation of ASP.NET based on a couple of big things that have happened with the web lately. ASP.NET 4.5 still lives on side-by-side with 5.</p>
<p>1. <strong>It is open source</strong> &ndash; You can read, branch and <a href="https://github.com/aspnet/">contribute to both asp.net</a> and the <a href="https://github.com/dotnet/">underlying framework</a> <span style="color: #333333;"><a href="#DNX">DNX Core</a></span>, along with a lot of other parts of .net like the <span style="color: #000000;"><a href="#Roslyn">ROSLYN</a> </span>compiler. You can also contribute to the <a href="https://docs.asp.net/">docs</a>, and/or participate in the <a href="https://live.asp.net/">bi-weekly community standup</a>.</p>
<p>&nbsp;</p>
<div style="background: beige; border: gray 0.1em solid; padding: 10px;"><strong>PRO TIP:</strong> Don&rsquo;t fall into the trap and start blabbering about how you downloaded the <a href="https://msdn.microsoft.com/en-us/library/cc749640.aspx">CLI Source way back in 2002</a>.&nbsp; 1. you will sound like a grandpa and 2. you will sound like a grandpa who thinks that museum open source (looki looki no touch) is the same as real open source.</div>
<p>&nbsp;</p>
<p>2. <strong>It is cross platform</strong> &ndash; earlier ASP.NET was tightly coupled with IIS, but now all you need is a web server that implements<span style="color: #8064a2;"><a href="#OWIN">OWIN</a></span> like the cross-platform development webserver <span style="color: #000000;"><a href="#Selfhost">Kestrel</a></span>, or you can <span style="color: #000000;"><a href="#Selfhost">self-host</a></span> with <span style="color: #000000;"><a href="#WebListener">WebListener</a></span>. DNX Core is the cross platform .net runtime that lets you run .net apps on Linux or Mac, in the cloud or on prem and you can write the app with your choice of editor/IDE whether it is Visual Studio, <a href="https://www.visualstudio.com/products/code-vs.aspx">Visual Studio Code</a>, Notepad, Sublime or something else.</p>
<div style="background: beige; border: gray 0.1em solid; padding: 10px;"><strong>Trivia:</strong> You can run ASP.NET 5 apps on <a href="http://www.hanselman.com/blog/HowToRunASPNET5Beta3OrGoLangOnARaspberryPi2.aspx">Raspberry Pi</a>&nbsp;</div>
<p>&nbsp;</p>
<p>3. <strong>It is modular</strong> &ndash; when you create an asp.net web forms app or ASP.NET MVC app you no longer have to include all of ASP.NET, you just pick and choose the parts you like. If you don&rsquo;t need authentication, then don&rsquo;t include it. The modularity means that the footprint is smaller and with less things in the pipeline everything is faster.</p>
<p>&nbsp;</p>
<p>4. <strong>It&rsquo;s fast</strong> &ndash; The ASP.NET team takes the performance thing very seriously, <a href="https://github.com/aspnet/benchmarks">benchmarking this and that</a>. But it is not only fast performance wise, the dev cycle is also faster. It has now been shortened from save-build-browse to save-browse, huge improvement YAY!</p>
<p>&nbsp;</p>
<p>5. <strong>It is built for the cloud</strong> &ndash; with features like <a href="https://docs.asp.net/en/latest/fundamentals/environments.html">environment based configuration</a>, and <a href="https://docs.asp.net/en/latest/security/app-secrets.html">hiding client secrets</a> so they don&rsquo;t accidentally end up on GitHub. Because it is modular you can also do things like replace the normal asp.net cache with <a href="http://redis.io/">Redis</a>.</p>
<p>But there is another big thing that has happened to the web, and that is the move from the server to the client. In the last 15 years we have gone from ASP spitting out HTML to <span style="color: #000000;"><a href="#SPA">SPA</a> Applications</span>&nbsp;with full <span style="color: #000000;"><a href="#MVVM">MVVM</a></span> JavaScript frameworks like <span style="color: #000000;"><a href="#Angular">AngularJS</a></span> that do everything on the client, and just use the server to fetch data. We have nice skinnable css/js component libraries like <span style="color: #000000;"><a href="#Bootstrap">Bootstrap</a></span>. And even ways to write easier to read JavaScript with <span style="color: #000000;"><a href="#Typescript">TypeScript</a></span> or <span style="color: #000000;"><a href="#CoffeeScript">CoffeeScript</a></span> and CSS with <span style="color: #000000;"><a href="#LessSass">less</a></span><a href="#LessSass"> or </a><span style="color: #000000;"><a href="#LessSass">sass</a></span>.</p>
<p>&nbsp;</p>
<div style="background: beige; border: gray 0.1em solid; padding: 10px;"><strong>PRO TIP:&nbsp; </strong>You can pick up a lot of one-liners from Scott Hanselman&rsquo;s hilarious <a href="https://channel9.msdn.com/events/TechDays-Sweden/TechDays-Sweden-2015/Keynote-Day-2">JavaScript and the Rise of the new Virtual Machine</a>. Or just watch it to get entertained and marvel at how far JavaScript has come.&nbsp; The talk starts 8:20 min in, straight after the fabulous introduction, &ldquo;This is Scott Hanselman, he is a very famous guy on the internet&rdquo;<img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6644.wlEmoticon-smile_6F9EC7F5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6644.wlEmoticon_2D00_smile_5F00_6F9EC7F5.png" alt="Smile" /></div>
<p>&nbsp;</p>
<p>Now you could either use something like AngularJS to write the whole application and just use ASP.NET Web API to fetch the data. Or you can mix and match ASP.NET MVC and Angular, where ASP.NET MVC could be used to route between multiple smaller SPAs and then you could use Angular routing inside the individual SPAs.</p>
<p>&nbsp;</p>
<p>To make all this jive together we need to use a few tools:</p>
<p>As .net developers we are used to use NuGet to download .NET modules to use in our apps. There are similar package managers that you can use to download JavaScript frameworks, or <span style="color: #000000;">Bootstrap</span> or other client side packages. The most common ones are <span style="color: #000000;"><a href="#NPM">NPM</a></span> (Node Package Manager) and <span style="color: #000000;"><a href="#Bower">Bower</a></span>.</p>
<p>Once you have written all your JavaScript code you may want to <span style="color: #000000;"><a href="#Minify">minify</a></span> it or <span style="color: #000000;"><a href="#Uglify">uglify</a></span> it or do other client side tasks like converting <span style="color: #000000;">CoffeeScript</span> to JavaScript and this is done with a task runners like <span style="color: #000000;"><a href="#GruntGulp">Grunt</a></span><a href="#GruntGulp"> or </a><span style="color: #000000;"><a href="#GruntGulp">Gulp</a></span>.</p>
<p>To get started, you can actually create your ASP.NET 5 project by hand. The only thing that is really needed for a DNX core project is a project.json file and a startup.cs.</p>
<p>The project.json file is where you define your project and add in all your dependencies (watch the magic in the references section when you add a dependency and save). The startup.cs file has two important methods, <em></em><em>ConfigureServices</em> where you add in the services you are going to use (like MVC), and <em><span style="color: #9b00d3;">Configure</span></em>, where you add them to the pipeline by calling the Use method.</p>
<p><strong>project.json <br /></strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">"webroot"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"wwwroot"</span><span style="color: #d0d0d0;">,</span>
  <span style="font-weight: bold; color: #6ab825;">"version"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"1.0.0-*"</span><span style="color: #d0d0d0;">,</span>

  <span style="font-weight: bold; color: #6ab825;">"dependencies"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">"Microsoft.AspNet.Server.IIS"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"1.0.0-beta5"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"Microsoft.AspNet.Server.WebListener"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"1.0.0-beta5"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"Microsoft.AspNet.Mvc"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"6.0.0-beta5"</span>
  <span style="color: #d0d0d0;">},</span>

  <span style="font-weight: bold; color: #6ab825;">"commands"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">"web"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"Microsoft.AspNet.Hosting --config hosting.ini"</span>
  <span style="color: #d0d0d0;">},</span>

  <span style="font-weight: bold; color: #6ab825;">"frameworks"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">"dnx451"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span> <span style="color: #d0d0d0;">},</span>
    <span style="font-weight: bold; color: #6ab825;">"dnxcore50"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span> <span style="color: #d0d0d0;">}</span>
  <span style="color: #d0d0d0;">},</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p>&nbsp;</p>
<p><strong>startup.cs <br /></strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;">    <span style="font-weight: bold; color: #6ab825;">public</span> <span style="font-weight: bold; color: #6ab825;">class</span> <span style="text-decoration: underline; color: #447fcf;">Startup</span>
    <span style="color: #d0d0d0;">{</span>
        <span style="font-weight: bold; color: #6ab825;">public</span> <span style="font-weight: bold; color: #6ab825;">void</span> <span style="color: #447fcf;">ConfigureServices</span><span style="color: #d0d0d0;">(IServiceCollection</span> <span style="color: #d0d0d0;">services)</span>
        <span style="color: #d0d0d0;">{</span>
            <span style="color: #d0d0d0;">services.AddMvc();</span>
        <span style="color: #d0d0d0;">}</span>

        <span style="font-weight: bold; color: #6ab825;">public</span> <span style="font-weight: bold; color: #6ab825;">void</span> <span style="color: #447fcf;">Configure</span><span style="color: #d0d0d0;">(IApplicationBuilder</span> <span style="color: #d0d0d0;">app)</span>
        <span style="color: #d0d0d0;">{</span>
            <span style="color: #d0d0d0;">app.UseMvc();</span>
        <span style="color: #d0d0d0;">}</span>
    <span style="color: #d0d0d0;">}</span></pre>
</div>
<p>Now, if you don&rsquo;t want to do everything by hand, you can create an ASP.NET 5 project in Visual Studio, or you can scaffold one out with the <span style="color: #000000;"><a href="#Yo">Yeoman</a></span><a href="#Yo"> tool (yo)</a> on Mac for example.</p>
<p>That is basically the gist of it, but phew&hellip; that was a slew of words and tools and technologies that until recently used to be gibberish to me. A lot of them have been known for a long time by people that develop for the mean stack (MongoDB, Express, Angular, Node.JS) but it is not until now that they have been properly married with ASP.NET and the MS stack.</p>
<h3>Oh, so many new words, my brain is exploding&hellip;</h3>
<p><strong><span style="color: #9b00d3;"><a name="DNX"></a>DNX</span></strong> &ndash; DNX is short for .NET execution engine. There are two main flavors, DNX 4.5.X (the full framework) and DNX Core 5.0 (the light-weight open source .NET version that also runs on Linux and Mac). DNX Core contains almost everything but is missing a few Windows namespaces like System.Drawing for example.</p>
<p><strong><span style="color: #9b00d3;"><a name="Roslyn"></a>ROSLYN</span></strong> &ndash; Roslyn is the new .NET compiler and it gives you some pretty neat features like real-time code analysis in Visual Studio (you know the light bulbs with quick hints and tips).</p>
<p><strong><span style="color: #9b00d3;"><a name="OWIN"></a>OWIN</span></strong> &ndash; Open Web Interface for .NET - a standard interface between .net web servers and web applications.&nbsp; Earlier, ASP.NET was tightly coupled with IIS. The purpose of OWIN is to break this relationship so that if you have a web server that implements OWIN correctly you can run ASP.NET on that web server. It also allows for more modularization so that you can plug and play things like MVC or authentication.</p>
<p><strong><span style="color: #9b00d3;">Katana</span></strong> - A set of OWIN components built and released by Microsoft (open source), with both hosts, servers and functional components like bindings to frameworks like <a href="http://signalr.net/">SignalR</a> and <a href="http://www.asp.net/web-api">ASP.NET Web API</a>.</p>
<p><strong><span style="color: #9b00d3;"><a name="Selfhost"></a>Self-hosting</span></strong> - If you want to avoid the overhead of hosting a Web API in IIS and want something more lightweight, you can host it in your own process, i.e. self-hosting.&nbsp; Self-hosting can also refer to a compiler that is written in the language it compiles, like the Roslyn C# compiler.</p>
<p><strong><span style="color: #9b00d3;"><a name="WebListener"></a>WebListener</span></strong> &ndash; a self-host ASP.NET 5 web server <a href="https://www.nuget.org/packages/Microsoft.AspNet.Server.WebListener">available on NuGet</a></p>
<p><strong><span style="color: #9b00d3;"><a name="Kestrel"></a>Kestrel</span></strong> &ndash; a cross platform ASP.NET 5 development web server <a href="https://www.nuget.org/packages/Microsoft.AspNet.Server.Kestrel/">available on NuGet</a></p>
<p><strong><span style="color: #9b00d3;"><a name="SPA"></a>SPA</span></strong> &ndash; Single Page Application. A web app that fits into a single web page (i.e. one get from the server), and where all the HTML, JavaScript and CSS is either gathered in one go, or loaded dynamically. Normally this is used in conjunction with JavaScript MVVM or MVC frameworks like AngularJS, Ember.js or React.</p>
<p><strong><span style="color: #9b00d3;"><a name="MVVM"></a>MVVM</span></strong> &ndash; Model View ViewModel &ndash; a common pattern for apps where you separate the code for a page into 3 separate layers. View is the UI for the page, Model is the data, and ViewModel is an interface between the View and the Data with logic that massages the data so that it fits the view.</p>
<p><strong><span style="color: #9b00d3;"><a name="MVC"></a>MVC</span></strong> &ndash; Model View Controller &ndash; Very similar to MVVM and also the pattern that MVVM stems from. Instead of using a ViewModel it uses a Controller to communicate between the model and the view.</p>
<p><strong><span style="color: #9b00d3;"><a name="Angular"></a>AngularJS</span></strong> &ndash; <a href="https://angular.io/">Angular</a> is a client-side MVVM JavaScript framework from Google that does everything from data binding and templating to client-side routing and more. Some claim it is getting to big and monolithic, and lucky for them there is a gazillion other JavaScript frameworks to choose from like <a href="http://emberjs.com/">Ember.js</a>, <a href="http://backbonejs.org/">Backbone.js</a>, <a href="http://knockoutjs.com/">Knockout.js</a>, <a href="http://facebook.github.io/react/">React</a> etc. etc. etc. For a nice walkthrough, read <a href="http://stephenwalther.com/archive/2015/01/12/asp-net-5-and-angularjs-part-1-configuring-grunt-uglify-and-angularjs">Stephen Walther&rsquo;s ASP.NET 5 and AngularJS tutorial</a></p>
<div style="background: beige; border: gray 0.1em solid; padding: 10px;"><strong>PRO TIP:</strong> If people get all in a huff and a puff about which framework is the best, just let them battle it out, and then say: "Sure, but those frameworks are so last week, I'm using <a href="http://codepo8.github.io/redact.js/">redact.js</a>, it's superfast and easy to use, increases perf on any website by about 60%. It has that Coco Chanel minimalist quality, and it&rsquo;s open source"</div>
<p><strong><span style="color: #9b00d3;"><a name="Bootstrap"></a>Bootstrap</span></strong> &ndash; <a href="http://getbootstrap.com/">Bootstrap</a> is a sweet framework with components for responsive web apps written in HTML, CSS and JavaScript. Navigation elements, Jumbotrons, Special buttons, layout sections etc. with a large community of people doing skins/themes like the ones on <a href="http://bootswatch.com/">http://bootswatch.com/</a> or <a href="http://www.bootstrapzero.com/">http://www.bootstrapzero.com/</a>.</p>
<p><strong><span style="color: #9b00d3;"><a name="Typescript"></a>TypeScript</span></strong> &ndash; <a href="http://www.typescriptlang.org/">TypeScript</a> is kinda like JavaScript for c# developers. You can use classes and modules and interfaces, and then it compiles down to vanilla JavaScript. In Visual Studio, the conversion to JavaScript happens when you save, and you get full intellisense, Roslyn light bulbs and proper code analysis with error lists etc.</p>
<p><strong>Sample TypeScript</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="font-weight: bold; color: #6ab825;">class</span> <span style="color: #d0d0d0;">Greeter</span> <span style="color: #d0d0d0;">{</span>
    <span style="color: #d0d0d0;">greeting</span>: <span style="font-weight: bold; color: #6ab825;">string</span><span style="color: #d0d0d0;">;</span>
    <span style="font-weight: bold; color: #6ab825;">constructor</span><span style="color: #d0d0d0;">(message</span>: <span style="font-weight: bold; color: #6ab825;">string</span><span style="color: #d0d0d0;">)</span> <span style="color: #d0d0d0;">{</span>
        <span style="font-weight: bold; color: #6ab825;">this</span><span style="color: #d0d0d0;">.greeting</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">message;</span>
    <span style="color: #d0d0d0;">}</span>
    <span style="color: #d0d0d0;">greet() {</span>
        <span style="font-weight: bold; color: #6ab825;">return</span> <span style="color: #ed9d13;">"Hello, "</span> <span style="color: #d0d0d0;">+</span> <span style="font-weight: bold; color: #6ab825;">this</span><span style="color: #d0d0d0;">.greeting;</span>
    <span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p><strong>Corresponding JavaScript</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="font-weight: bold; color: #6ab825;">var</span> <span style="color: #d0d0d0;">Greeter</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">(</span><span style="font-weight: bold; color: #6ab825;">function</span> <span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">function</span> <span style="color: #d0d0d0;">Greeter(message)</span> <span style="color: #d0d0d0;">{</span>
        <span style="font-weight: bold; color: #6ab825;">this</span><span style="color: #d0d0d0;">.greeting</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">message;</span>
    <span style="color: #d0d0d0;">}</span>
    <span style="color: #d0d0d0;">Greeter.prototype.greet</span> <span style="color: #d0d0d0;">=</span> <span style="font-weight: bold; color: #6ab825;">function</span> <span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
        <span style="font-weight: bold; color: #6ab825;">return</span> <span style="color: #ed9d13;">"Hello, "</span> <span style="color: #d0d0d0;">+</span> <span style="font-weight: bold; color: #6ab825;">this</span><span style="color: #d0d0d0;">.greeting;</span>
    <span style="color: #d0d0d0;">};</span>
    <span style="font-weight: bold; color: #6ab825;">return</span> <span style="color: #d0d0d0;">Greeter;</span>
<span style="color: #d0d0d0;">})();</span></pre>
</div>
<p><strong><span style="color: #9b00d3;"><a name="CoffeeScript"></a>CoffeeScript</span></strong> &ndash; Similar to TypeScript, CoffeeScript is also a language that compiles down to JavaScript. Its purpose is to simplify JavaScript. If you want to use CoffeeScript in Visual Studio, you can either use a Grunt or Gulp task to compile it to JavaScript on save or you can install the Visual Studio <a href="https://visualstudiogallery.msdn.microsoft.com/3b329021-cd7a-4a01-86fc-714c2d05bb6c">WebCompiler extension</a> that will do it for you.</p>
<p><strong>Sample CoffeeScript</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #d0d0d0;">alert</span> <span style="color: #ed9d13;">"I knew it!"</span> <span style="font-weight: bold; color: #6ab825;">if</span> <span style="color: #d0d0d0;">elvis?</span></pre>
</div>
<p><strong>Corresponding JavaScript</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #d0d0d0;">(</span><span style="font-weight: bold; color: #6ab825;">function</span><span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">if</span> <span style="color: #d0d0d0;">(</span><span style="font-weight: bold; color: #6ab825;">typeof</span> <span style="color: #d0d0d0;">elvis</span> <span style="color: #d0d0d0;">!==</span> <span style="color: #ed9d13;">"undefined"</span> <span style="color: #d0d0d0;">&amp;&amp;</span> <span style="color: #d0d0d0;">elvis</span> <span style="color: #d0d0d0;">!==</span> <span style="font-weight: bold; color: #6ab825;">null</span><span style="color: #d0d0d0;">)</span> <span style="color: #d0d0d0;">{</span>
    <span style="color: #d0d0d0;">alert(</span><span style="color: #ed9d13;">"I knew it!"</span><span style="color: #d0d0d0;">);</span>
  <span style="color: #d0d0d0;">}</span>

<span style="color: #d0d0d0;">}).call(</span><span style="font-weight: bold; color: #6ab825;">this</span><span style="color: #d0d0d0;">);</span></pre>
</div>
<p>&nbsp;</p>
<div style="background: beige; border: gray 0.1em solid; padding: 10px;"><strong>Fun from the Interwebs:</strong> Before you start rolling your eyes, Yes! I know that Java and JavaScript are about as related as C# and C, but all that talk about Coffee and Java made me remember my favorite article from The Daily WTF about the <a href="http://thedailywtf.com/Articles/The_Brillant_Paula_Bean">Brillant Paula Bean</a></div>
<p><strong><span style="color: #9b00d3;">ECMAScript</span></strong> &ndash; ECMAScript is a scripting language specification. The more common implementations are JavaScript and JScript.</p>
<p><strong><span style="color: #9b00d3;"><a name="LessSass"></a>Less and Sass</span></strong> &ndash; <a href="http://lesscss.org/">Less</a> and <a href="http://sass-lang.com/">Sass</a> are to CSS what TypeScript and CoffeeScript are to JavaScript. They both aim to make it simpler to write CSS, and you can use Grunt or Gulp or WebCompiler to convert the less or sass files to CSS and/or minified CSS files on save.&nbsp; Among other things, you can use them to define re-usable CSS content like red and .bordered below, and also nest css nicely.</p>
<p><strong>Sample Less file</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="font-weight: bold; color: #6ab825;">@red</span><span style="color: #d0d0d0;">:</span> <span style="color: #447fcf;">#FF0000</span><span style="color: #d0d0d0;">;</span>

<span style="text-decoration: underline; color: #447fcf;">.bordered</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">border-top</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">dotted</span> <span style="color: #3677a9;">1px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
    <span style="font-weight: bold; color: #6ab825;">border-bottom</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">solid</span> <span style="color: #3677a9;">2px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
<span style="color: #d0d0d0;">}</span>

<span style="color: #447fcf;">#menu</span> <span style="color: #d0d0d0;">{</span>
    <span style="text-decoration: underline; color: #447fcf;">.bordered;</span>
    <span style="color: #6ab825;">a</span> <span style="color: #d0d0d0;">{</span> <span style="font-weight: bold; color: #6ab825;">color</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">@</span><span style="color: #24909d;">red</span><span style="color: #d0d0d0;">;</span> <span style="color: #d0d0d0;">}</span>
    <span style="font-weight: bold; color: #6ab825;">a</span><span style="color: #ffa500;">:visited</span> <span style="color: #d0d0d0;">{</span> <span style="font-weight: bold; color: #6ab825;">color</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">desaturate(@</span><span style="color: #24909d;">red</span><span style="color: #d0d0d0;">,</span> <span style="color: #3677a9;">10</span><span style="color: #d0d0d0;">%);</span> <span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p>&nbsp;<strong>Sample Sass file</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #40ffff;">$red</span><span style="color: #d0d0d0;">:</span> <span style="color: #3677a9;">#FF0000</span><span style="color: #d0d0d0;">;</span>

<span style="text-decoration: underline; color: #447fcf;">.bordered</span> <span style="color: #d0d0d0;">{</span>
    <span style="color: #bbbbbb;">border-top</span><span style="color: #d0d0d0;">:</span> <span style="color: #40ffff;">dotted</span> <span style="color: #3677a9;">1</span><span style="font-weight: bold; color: #6ab825;">px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
    <span style="color: #bbbbbb;">border-bottom</span><span style="color: #d0d0d0;">:</span> <span style="color: #40ffff;">solid</span> <span style="color: #3677a9;">2</span><span style="font-weight: bold; color: #6ab825;">px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
<span style="color: #d0d0d0;">}</span>

<span style="text-decoration: underline; color: #447fcf;">#menu</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">@extend</span> <span style="text-decoration: underline; color: #447fcf;">.bordered</span><span style="color: #d0d0d0;">;</span>
    <span style="color: #bbbbbb;">a</span><span style="color: #bbbbbb;">{</span><span style="color: #bbbbbb;">color</span><span style="color: #d0d0d0;">:</span> <span style="color: #40ffff;">$red</span><span style="color: #d0d0d0;">;</span> <span style="color: #d0d0d0;">}</span>
    <span style="color: #bbbbbb;">a</span><span style="color: #d0d0d0;">:visited</span> <span style="color: #d0d0d0;">{</span> <span style="color: #40ffff;">color</span><span style="color: #d0d0d0;">:</span> <span style="color: #447fcf;">desaturate</span><span style="color: #d0d0d0;">(</span><span style="color: #40ffff;">$red</span><span style="color: #d0d0d0;">,</span> <span style="color: #3677a9;">10</span><span style="font-weight: bold; color: #6ab825;">%</span><span style="color: #d0d0d0;">)</span><span style="color: #d0d0d0;">;</span> <span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p>&nbsp;<strong>Resulting CSS</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="text-decoration: underline; color: #447fcf;">.bordered</span> <span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">border-top</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">dotted</span> <span style="color: #3677a9;">1px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
  <span style="font-weight: bold; color: #6ab825;">border-bottom</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">solid</span> <span style="color: #3677a9;">2px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #447fcf;">#menu</span> <span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">border-top</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">dotted</span> <span style="color: #3677a9;">1px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
  <span style="font-weight: bold; color: #6ab825;">border-bottom</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">solid</span> <span style="color: #3677a9;">2px</span> <span style="color: #24909d;">black</span><span style="color: #d0d0d0;">;</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #447fcf;">#menu</span> <span style="font-weight: bold; color: #6ab825;">a</span> <span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">color</span><span style="color: #d0d0d0;">:</span> <span style="color: #3677a9;">#FF0000</span><span style="color: #d0d0d0;">;</span>
<span style="color: #d0d0d0;">}</span>
<span style="color: #447fcf;">#menu</span> <span style="font-weight: bold; color: #6ab825;">a</span><span style="color: #ffa500;">:visited</span> <span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">color</span><span style="color: #d0d0d0;">:</span> <span style="color: #3677a9;">#f20d0d</span><span style="color: #d0d0d0;">;</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p>&nbsp;</p>
<p><strong><span style="color: #9b00d3;"><a name="NPM"></a>NPM</span></strong> &ndash; NPM (Node Package Manager) is like NuGet for client-side stuff. Add an NPM configuration file (package.json) to your ASP.NET 5 app and load in the proper references by adding them to the devDependencies section. When you save the file you&rsquo;ll see them show up under References/NPM. Typical things you would download with NPM are Grunt or Gulp or Bower.</p>
<p><strong>Sample package.json file</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">"version"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"1.0.0"</span><span style="color: #d0d0d0;">,</span>
  <span style="font-weight: bold; color: #6ab825;">"name"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"MyASPNETApp"</span><span style="color: #d0d0d0;">,</span>
  <span style="font-weight: bold; color: #6ab825;">"devDependencies"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">"grunt"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"0.4.5"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"grunt-contrib-uglify"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"0.10.0"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"grunt-contrib-watch"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"0.6.1"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"gulp"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"3.9.0"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"gulp-uglify"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"1.4.2"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"gulp-concat"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"2.6.0"</span>
  <span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p>&nbsp;</p>
<p><strong><span style="color: #9b00d3;"><a name="Bower"></a>Bower</span></strong> &ndash; Bower is also like NuGet for web stuff. Similar to NPM you add a bower configuration file (bower.json) to your app. The libraries will be downloaded to the wwwroot/lib folder by default. The * here means we will download the latest version of angular.</p>
<p><strong>Sample bower.json file<a name="Minify"></a></strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #d0d0d0;">{</span>
  <span style="font-weight: bold; color: #6ab825;">"name"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"ASP.NET"</span><span style="color: #d0d0d0;">,</span>
  <span style="font-weight: bold; color: #6ab825;">"private"</span><span style="color: #d0d0d0;">:</span> <span style="font-weight: bold; color: #6ab825;">true</span><span style="color: #d0d0d0;">,</span>
  <span style="font-weight: bold; color: #6ab825;">"dependencies"</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">{</span>
    <span style="font-weight: bold; color: #6ab825;">"bootstrap"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"3.0.0"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"bootstrap-touch-carousel"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"0.8.0"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"angular"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"*"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"angular-route"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"*"</span><span style="color: #d0d0d0;">,</span>
    <span style="font-weight: bold; color: #6ab825;">"angular-resource"</span><span style="color: #d0d0d0;">:</span> <span style="color: #ed9d13;">"*"</span>
  <span style="color: #d0d0d0;">}</span>
<span style="color: #d0d0d0;">}</span></pre>
</div>
<p><strong><span style="color: #9b00d3;"><a name="Minify"></a>Minify</span></strong> &ndash; To avoid sending too much over the wire you can minify CSS and JavaScript. Minification means that you remove any characters that are non-essential, like white-space, new-lines and comments.</p>
<p><strong><span style="color: #9b00d3;"><a name="Uglify"></a>Uglify</span></strong> &ndash; Uglifying is a little bit like minifying, but usually you also concatenate a number of JavaScript or CSS files into one, and then Minify it. This is a typical task for Grunt or Gulp.&nbsp;</p>
<p><strong><span style="color: #9b00d3;"><a name="GruntGulp"></a>Grunt and Gulp</span></strong> &ndash; <a href="http://gruntjs.com/">Grunt</a> and <a href="http://gulpjs.com/">Gulp</a> are both task runners that you use to perform tasks like minifying or uglifying css and javascript, or compiling less and sass into css, or TypeScript and CoffeeScript into JavaScript. In Visual Studio you can open the Task Runner window to run the tasks manually. The following sample shows how you can watch for changes in JavaScript files and whenever something changes, concatenate/uglify them into a single app.js file that you place in the wwwroot folder.</p>
<p><strong>The Grunt way:</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="color: #d0d0d0;">module.exports</span> <span style="color: #d0d0d0;">=</span> <span style="font-weight: bold; color: #6ab825;">function</span> <span style="color: #d0d0d0;">(grunt)</span> <span style="color: #d0d0d0;">{</span>
    <span style="color: #d0d0d0;">grunt.loadNpmTasks(</span><span style="color: #ed9d13;">'grunt-contrib-uglify'</span><span style="color: #d0d0d0;">);</span>
    <span style="color: #d0d0d0;">grunt.loadNpmTasks(</span><span style="color: #ed9d13;">'grunt-contrib-watch'</span><span style="color: #d0d0d0;">);</span>

    <span style="color: #d0d0d0;">grunt.initConfig({</span>
        <span style="color: #d0d0d0;">uglify:</span> <span style="color: #d0d0d0;">{</span>
            <span style="color: #d0d0d0;">my_target:</span> <span style="color: #d0d0d0;">{</span>
                <span style="color: #d0d0d0;">files:</span> <span style="color: #d0d0d0;">{</span>
                    <span style="color: #ed9d13;">'wwwroot/app.js'</span><span style="color: #d0d0d0;">:</span> <span style="color: #d0d0d0;">[</span><span style="color: #ed9d13;">'Scripts/app.js'</span><span style="color: #d0d0d0;">,</span> <span style="color: #ed9d13;">'Scripts/**/*.js'</span><span style="color: #d0d0d0;">]</span>
                <span style="color: #d0d0d0;">}</span>
            <span style="color: #d0d0d0;">}</span>
        <span style="color: #d0d0d0;">},</span>
        <span style="color: #d0d0d0;">watch:</span> <span style="color: #d0d0d0;">{</span>
            <span style="color: #d0d0d0;">scripts:</span> <span style="color: #d0d0d0;">{</span>
                <span style="color: #d0d0d0;">files:</span> <span style="color: #d0d0d0;">[</span><span style="color: #ed9d13;">'Scripts/**/*.js'</span><span style="color: #d0d0d0;">],</span>
                <span style="color: #d0d0d0;">tasks:</span> <span style="color: #d0d0d0;">[</span><span style="color: #ed9d13;">'uglify'</span><span style="color: #d0d0d0;">]</span>
            <span style="color: #d0d0d0;">}</span>
        <span style="color: #d0d0d0;">}</span>
    <span style="color: #d0d0d0;">});</span>

    <span style="color: #999999; font-style: italic;">//define tasks</span>
    <span style="color: #d0d0d0;">grunt.registerTask(</span><span style="color: #ed9d13;">'default'</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">[</span><span style="color: #ed9d13;">'uglify'</span><span style="color: #d0d0d0;">,</span> <span style="color: #ed9d13;">'watch'</span><span style="color: #d0d0d0;">]);</span>
<span style="color: #d0d0d0;">};</span></pre>
</div>
<p><strong>The Gulp way:</strong></p>
<!-- HTML generated using hilite.me -->
<div style="overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; width: auto; background: #202020; border-bottom: gray 0.1em solid; padding-bottom: 0.2em; padding-top: 0.2em; padding-left: 0.6em; border-left: gray 0.8em solid; padding-right: 0.6em;">
<pre style="margin: 0px; line-height: 125%;"><span style="font-weight: bold; color: #6ab825;">var</span> <span style="color: #d0d0d0;">gulp</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">require(</span><span style="color: #ed9d13;">'gulp'</span><span style="color: #d0d0d0;">);</span>
<span style="font-weight: bold; color: #6ab825;">var</span> <span style="color: #d0d0d0;">concat</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">require(</span><span style="color: #ed9d13;">'gulp-concat'</span><span style="color: #d0d0d0;">);</span>
<span style="font-weight: bold; color: #6ab825;">var</span> <span style="color: #d0d0d0;">uglify</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">require(</span><span style="color: #ed9d13;">'gulp-uglify'</span><span style="color: #d0d0d0;">);</span>

<span style="color: #d0d0d0;">gulp.task(</span><span style="color: #ed9d13;">'scripts'</span><span style="color: #d0d0d0;">,</span> <span style="font-weight: bold; color: #6ab825;">function</span> <span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
    <span style="color: #d0d0d0;">gulp.src([</span><span style="color: #ed9d13;">'Scripts/app.js'</span><span style="color: #d0d0d0;">,</span> <span style="color: #ed9d13;">'Scripts/**/*.js'</span><span style="color: #d0d0d0;">])</span>
        <span style="color: #d0d0d0;">.pipe(concat(</span><span style="color: #ed9d13;">'app.js'</span><span style="color: #d0d0d0;">))</span>
        <span style="color: #d0d0d0;">.pipe(uglify())</span>
        <span style="color: #d0d0d0;">.pipe(gulp.dest(</span><span style="color: #ed9d13;">'wwwroot'</span><span style="color: #d0d0d0;">));</span>
<span style="color: #d0d0d0;">});</span>

<span style="color: #d0d0d0;">gulp.task(</span><span style="color: #ed9d13;">'default'</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">[</span><span style="color: #ed9d13;">'scripts'</span><span style="color: #d0d0d0;">],</span> <span style="font-weight: bold; color: #6ab825;">function</span> <span style="color: #d0d0d0;">()</span> <span style="color: #d0d0d0;">{</span>
    <span style="color: #d0d0d0;">gulp.watch(</span><span style="color: #ed9d13;">'Scripts/**/*.js'</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">[</span><span style="color: #ed9d13;">'scripts'</span><span style="color: #d0d0d0;">]);</span>
<span style="color: #d0d0d0;">});</span></pre>
</div>
<p><strong><span style="color: #9b00d3;"><a name="Yo"></a>Yeoman/Yo</span></strong> &ndash; <a href="http://yeoman.io/">Yo</a> is a scaffolding tool, together with the <a href="https://github.com/omnisharp/generator-aspnet">OmniSharp ASP.NET generator (generator-aspnet)</a> that you can download with npm, <a href="https://docs.asp.net/en/latest/tutorials/your-first-mac-aspnet.html">it lets you quickly create a new empty asp.net 5 app where you don&rsquo;t have Visual Studio</a> (like on Mac or Linux).</p>
<p>&nbsp;</p>
<p>Hopefully that should be enough to make you a little bit more comfortable with the hipster crowd, but if all else fails, just start mumbling about some obscure Powershell cmdlet and they will all dissapear.</p>]]></content:encoded>
    </item>
    <item>
      <title>15 features I love in Visual Studio 2015 – part 3 Debugging features</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/15-features-i-love-in-visual-studio-2015-part-3-debugging-features</link>
      <pubDate>Mon, 26 Oct 2015 09:17:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2015/10/26/15-features-i-love-in-visual-studio-2015-part-3-debugging-features/</guid>
      <description><![CDATA[In this 3rd and final post it is time for the debugger features, yay!!!.&nbsp; You might want to...]]></description>
      <content:encoded><![CDATA[<p>In this 3rd and final post it is time for the debugger features, yay!!!.&nbsp; You might want to check out my 5 favorite <a href="http://blogs.msdn.com/b/tess/archive/2015/10/26/15-features-i-love-in-visual-studio-2015-part-1-editor-features.aspx">editor</a> and <a href="http://blogs.msdn.com/b/tess/archive/2015/10/26/15-features-i-love-in-visual-studio-2015-part-2-ide-features.aspx">IDE</a> features too.</p>
<h3>Debugging multi-statement lines with the autos window</h3>
<p>We have probably all debugged code like this, wanted to know what Helpers.DegreesToDirection returned and ended up re-writing the code temporarily to <strong>var dir = Helpers.DegreesToDirection</strong>&hellip;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3034.image_71EAD513.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3034.image_5F00_71EAD513.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5488.image_thumb_3D4D0989.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5488.image_5F00_thumb_5F00_3D4D0989.png" alt="image" width="644" height="110" border="0" /></a></p>
<p>As it turns out, this is completely unnecessary thanks to a feature that was introduced in Visual Studio 2013 but that few people know about.&nbsp;</p>
<p>If you step over the line with F10, and open the autos window, you will find that VS has already done the return split for you.&nbsp; Neat right?</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5381.image_386A55CD.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5381.image_5F00_386A55CD.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/1031.image_thumb_73518896.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1031.image_5F00_thumb_5F00_73518896.png" alt="image" width="644" height="143" border="0" /></a></p>
<h3>Live Visual Tree &ndash; or F12 tools for XAML</h3>
<p>Working with XAML for the past 3 years, I have been extremely jealous of the F12 tools for the web where one could simply press F12 in the browser and test and change styles and see the results live. And of course find out why an element rendered like it did.</p>
<p>Those tools have now arrived for XAML, in the form of</p>
<p>1. A Live Visual Tree that shows you all the XAML objects in the current visual tree, and lets you pick a XAML object from the tree, or pick a XAML object by selecting it in the app.</p>
<p>2. A Live Property Explorer that lets you change the properties and styles of the XAML elements while the app is running.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2248.Capture_432A3DD3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2248.Capture_5F00_432A3DD3.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Capture" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7230.Capture_thumb_62034262.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7230.Capture_5F00_thumb_5F00_62034262.png" alt="Capture" width="644" height="413" border="0" /></a></p>
<p>Read more about it on the <a href="http://blogs.msdn.com/b/visualstudio/archive/2015/02/24/introducing-the-ui-debugging-tools-for-xaml.aspx">Visual Studio blog</a></p>
<h3>PerfTips</h3>
<p>PerfTips is one of those, why didn&rsquo;t anyone think of this before???</p>
<p>When you break, while debugging, you will see the perftip at the end of the line you stopped at.&nbsp; The perftip tells you how long time how much time elapsed since you were last stopped. In this case it took around 3 seconds (give or take some overhead time for debugging) to execute the lines since the last breakpoint.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2112.image_1F26FDE8.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2112.image_5F00_1F26FDE8.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7103.image_thumb_75B2BCA7.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7103.image_5F00_thumb_5F00_75B2BCA7.png" alt="image" width="644" height="202" border="0" /></a>&nbsp;</p>
<p>This is an excellent way to find slow sections of your code without having to add your own stop watches and debug code.</p>
<p>Clicking on the perftip will show the diagnostic tools and filter by the last 3 seconds in this case, so I can narrow down the issue further.</p>
<p>For more information and a debugging scenario for perftips check out the <a href="http://blogs.msdn.com/b/visualstudioalm/archive/2014/08/18/perftips-performance-information-at-a-glance-while-debugging-with-visual-studio.aspx">VS Blog</a></p>
<h3>Diagnostic Tools</h3>
<p>The Diagnostic Tools is a set of tools that allow you to see historical data rather than just data from a single moment in time like typical application debugging.&nbsp; Most of this already existed in Visual Studio 2013 as separate entities (Intellitrace, events in the output window, performance and diagnostics hub with CPU and Memory usage tools and profiling).&nbsp;</p>
<p>In Visual Studio 2015 this is brought together in a fantastic Diagnostic Tools Window, it&rsquo;s a little bit like WindDbg light but with a UI<img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8424.wlEmoticon-smile_2C8FA19F.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8424.wlEmoticon_2D00_smile_5F00_2C8FA19F.png" alt="Smile" /></p>
<p>You can read a longer <a href="http://blogs.msdn.com/b/visualstudioalm/archive/2015/01/16/diagnostic-tools-debugger-window-in-visual-studio-2015.aspx">walkthrough of all the tools here</a>.&nbsp; I am just going to pick out 2 of them real quick</p>
<h4>Intellitrace or Historical debugging (only in the Enterprise version)</h4>
<p>In this example you can see that a number of NullReferenceExceptions were thrown and caught.&nbsp; You can see this both in the debugger and represented as red and gray diamonds in the event section up top.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5734.image_13279E65.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5734.image_5F00_13279E65.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4111.image_thumb_10154070.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4111.image_5F00_thumb_5F00_10154070.png" alt="image" width="534" height="484" border="0" /></a></p>
<p>The debugger didn&rsquo;t stop since they were handled and the process continued normally since they were caught, but they could still be causing havoc with perf, or something else so it is still interesting to find out what happened.</p>
<p>If you click on one of the exceptions, it will take you to the location and time where the exception happened. There is a reason this used to be called time travel debugging&hellip;</p>
<p>Depending on how much data you allow the debugger to save (which of course affects perf.) it could also have the locals stored.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4705.image_06BC0BED.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4705.image_5F00_06BC0BED.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0755.image_thumb_1D11B132.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0755.image_5F00_thumb_5F00_1D11B132.png" alt="image" width="644" height="202" border="0" /></a></p>
<p>So now we know why this happened and since it happens so often it might warrant a re-write where we check for null instead of try/catch</p>
<h4>Memory usage</h4>
<p>The Memory usage tab has a pretty neat feature that allows you find the root cause of a memory issue by taking snapshots of the process and comparing them.&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0451.image_0D05732C.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0451.image_5F00_0D05732C.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2308.image_thumb_03AC3EA9.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2308.image_5F00_thumb_5F00_03AC3EA9.png" alt="image" width="644" height="294" border="0" /></a></p>
<p>Here, I have taken two snapshots (2nd one is taken after clicking a refresh button in my app 4 times).</p>
<p>I can see without even looking at the snapshots that memory has increased by 49kb (not a lot but still), and the number of objects has increased by 789.</p>
<p>I then click on the +789 to get a list of all the objects on the heap, sorted by increase in instance count.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6114.image_377434FA.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6114.image_5F00_377434FA.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7077.image_thumb_5C08532F.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7077.image_5F00_thumb_5F00_5C08532F.png" alt="image" width="644" height="165" border="0" /></a></p>
<p>Now I look for something I recognize and find that the number of ForecastItems has grown by 28, so 7 per refresh button click&hellip;</p>
<p>and selecting the ForecastItems I get a root path at the bottom of the screen showing me that the reason these stick around is because they are part of ForecastViewModel which in turn is part of an observable collection of IForecastViewModels in MainViewModel</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7870.image_1B689771.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7870.image_5F00_1B689771.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3716.image_thumb_5D6F06B2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3716.image_5F00_thumb_5F00_5D6F06B2.png" alt="image" width="644" height="148" border="0" /></a></p>
<p>Armed with that it was pretty easy to go back to the code and track down why we accumulated ForecastViewModels, and the reason was because I forgot to Clear the Forecasts collection when I loaded new forecasts.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3817.image_2A9F003E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3817.image_5F00_2A9F003E.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8468.image_thumb_4F331E73.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8468.image_5F00_thumb_5F00_4F331E73.png" alt="image" width="644" height="169" border="0" /></a></p>
<h3>Lambdas in immediate and watch windows</h3>
<p>Digging through all the items in a collection (like the forecastResults) just to look at the value of Temp can be a real time-waster. So my last productivity tip in Visual Studio 2015 is use lambdas in the watch or the immediate window to grab just the bits you are interested in.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0044.image_6E75C546.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0044.image_5F00_6E75C546.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8308.image_thumb_5E698740.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8308.image_5F00_thumb_5F00_5E698740.png" alt="image" width="644" height="205" border="0" /></a></p>
<p><em>Note: since this is code that needs to run in the context of your method, you need to make sure that you have a using statement for Linq in your cs file to use this.</em></p>
<h3>Bonus: New Breakpoint IDE</h3>
<p>I think the new breakpoint IDE also deserves a mention even though I already picked my 15 fave features.</p>
<p>The new breakpoint window also uses the peek functionality so the breakpoint settings are made while you are still looking at the code rather than opening up another window.&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2364.image_0774263D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2364.image_5F00_0774263D.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5381.image_thumb_54A41FC8.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5381.image_5F00_thumb_5F00_54A41FC8.png" alt="image" width="644" height="215" border="0" /></a></p>
<p>The functionality you have here with setting conditional breakpoints and logging data to the output window is nothing new. It has been there for ages but it is now much more accessible and easy to use which makes me very happy both as an avid debugger, and as a UX aficionado.</p>
<p>&nbsp;</p>
<p>With that said, it is time for me to go back to my coffee, and vacation dreams.&nbsp;</p>
<p>&nbsp;</p>
<p>Tess</p>]]></content:encoded>
    </item>
    <item>
      <title>15 features I love in Visual Studio 2015 – part 2 IDE features</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/15-features-i-love-in-visual-studio-2015-part-2-ide-features</link>
      <pubDate>Mon, 26 Oct 2015 06:25:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2015/10/26/15-features-i-love-in-visual-studio-2015-part-2-ide-features/</guid>
      <description><![CDATA[Continuing my list of favorite features&nbsp;or "What's new in&nbsp;Visual Studio 2015", that...]]></description>
      <content:encoded><![CDATA[<p>Continuing my list of favorite features&nbsp;or "What's new in&nbsp;Visual Studio 2015", that started with a post on <a href="http://blogs.msdn.com/b/tess/archive/2015/10/26/15-features-i-love-in-visual-studio-2015-part-1-editor-features.aspx">Visual Studio editor features</a>, it&rsquo;s now time for the IDE.&nbsp; In the 3rd and final part I&rsquo;ll get to the real juicy new <a href="http://blogs.msdn.com/b/tess/archive/2015/10/26/15-features-i-love-in-visual-studio-2015-part-3-debugging-features.aspx">debugging features</a>.&nbsp;</p>
<h3>Saving and roaming the Window layouts I use the most</h3>
<p>I do almost all my development on a surface hooked up to an external monitor at work. Sometimes though I&rsquo;ll code in front of the TV or in a coffee shop if I have a meeting down town and then the screen real estate is so precious you would think&nbsp;the screen&nbsp;was located in TriBeCa.&nbsp;</p>
<p>This is my normal VS layout with all the essential panes pinned.&nbsp; I call this the &ldquo;Big Screen&rdquo; layout</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2664.image_13C785FC.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2664.image_5F00_13C785FC.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8461.image_thumb_7ED89439.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8461.image_5F00_thumb_5F00_7ED89439.png" alt="image" width="644" height="413" border="0" /></a></p>
<p>And this is my coffee shop &ldquo;Just the codez!!!&rdquo; layout with only the code editor window open.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6354.image_159A6C74.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6354.image_5F00_159A6C74.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0435.image_thumb_6BB9F83E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0435.image_5F00_thumb_5F00_6BB9F83E.png" alt="image" width="644" height="413" border="0" /></a></p>
<p>Rather than having to pin and un-pin all the windows every time I want to change layouts, Visual Studio now allows me to save my layout choices and apply them as I want.</p>
<p>Not only that, the layout also roams with my profile, the one I log into Visual Studio with, so I can use the same profile on other machines too.&nbsp; Awesome!</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4426.image_2CEA9247.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4426.image_5F00_2CEA9247.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4807.image_thumb_5EE4C382.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4807.image_5F00_thumb_5F00_5EE4C382.png" alt="image" width="547" height="484" border="0" /></a></p>
<h3><strong>Touch Support</strong></h3>
<p>I use touch a lot, for scrolling, zooming, you name it.&nbsp; In VS 2013 it could get pretty annoying trying to scroll a large piece of code with your fingers, but in VS 2015 you can now use the normal touch gestures to zoom, scroll, bring up context menus, select etc. It&rsquo;s one of those things, when you have it you don&rsquo;t notice it, when you don&rsquo;t it bothers you.</p>
<h3><strong>Device Design Previews</strong></h3>
<p>Universal Windows Apps (UWP) can run on any device that Windows 10 runs on which means that they can be running on anything from a small phone to a huge surface hub.&nbsp; The normal work flow would be to create a responsive design and then run it in a simulator or emulator, or maybe stretch and un-stretch the windows to see how it looks on different size hardware.&nbsp;</p>
<p>Device Design Previews lets you change the target size directly in the design window so you can test out the design without even running the app.&nbsp; Such a time saver.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5710.image_52E2D34E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5710.image_5F00_52E2D34E.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2570.image_thumb_7057B50B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2570.image_5F00_thumb_5F00_7057B50B.png" alt="image" width="545" height="484" border="0" /></a></p>
<h3>Error list filtering</h3>
<p>When you are in the middle of open heart surgery (you know when you&rsquo;ve started refactoring and it&rsquo;ll be a year and a half before you can compile again), then error list filtering is your friend.</p>
<p>With error list filtering you can filter errors by project, file, or even by error type so you can handle one group of errors at a time.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7181.image_54B5B9C6.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7181.image_5F00_54B5B9C6.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5852.image_thumb_4AF0524E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5852.image_5F00_thumb_5F00_4AF0524E.png" alt="image" width="644" height="286" border="0" /></a></p>
<h3>Microsoft Blend for Visual Studio 2015</h3>
<p>In the past, I would use Blend very occasionally, when I needed to create an animation. Then I would switch back to Visual Studio immediately, while still holding my breath, because Blend was frankly not a very nice environment to write code in. It had no intellisense, no source control, just not a safe environment for a developer.&nbsp;</p>
<p>But things have changed my friends.&nbsp; Blend now uses the VS IDE, which means it has intellisense, great solution handling, debugging, source control etc. etc.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3286.image_73FAF14A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3286.image_5F00_73FAF14A.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6378.image_thumb_6EAC0A99.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6378.image_5F00_thumb_5F00_6EAC0A99.png" alt="image" width="644" height="413" border="0" /></a></p>
<p>Fine, so it&rsquo;s almost like VS, but I already have Visual Studio.&nbsp; True, you can pretty much do everything in VS.&nbsp; What I use Blend for is; animations, state management (adaptive states for UWP apps) and Sample Data (it has an amazing sample data generator if you want to work on the design before you have the actual data).&nbsp; Blend makes it easier to do all these things through the IDE without having to remember how to write the code for it, and now I don&rsquo;t have to switch back and forth, which makes me more productive.</p>
<p>In the next and final post on the topic I&rsquo;ll list my favorite debugging features,</p>
<p>until then,</p>
<p>Tess&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>15 features I love in Visual Studio 2015 – part 1 editor features</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/15-features-i-love-in-visual-studio-2015-part-1-editor-features</link>
      <pubDate>Mon, 26 Oct 2015 05:09:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2015/10/26/15-features-i-love-in-visual-studio-2015-part-1-editor-features/</guid>
      <description><![CDATA[I spend the better part of my work day and a fair bit of my free time in Visual Studio so lately I...]]></description>
      <content:encoded><![CDATA[<p>I spend the better part of my work day and a fair bit of my free time in Visual Studio so lately I have been thinking about which ones of the new features boost my productivity the most, so I can spend more time drinking coffee and planning my vacations.&nbsp;</p>
<p>&nbsp;</p>
<p><em>Caveat: some of these are hidden gems from 2013</em></p>
<p>In this article (part 1) I will list my top 5 new editor features (in no particular order), and in the following ones I&rsquo;ll list my<a href="http://blogs.msdn.com/b/tess/archive/2015/10/26/15-features-i-love-in-visual-studio-2015-part-2-ide-features.aspx"> favorite IDE features</a> and <a href="http://blogs.msdn.com/b/tess/archive/2015/10/26/15-features-i-love-in-visual-studio-2015-part-3-debugging-features.aspx">debugging</a> features in VS 2015.</p>
<h3>Improved Code Lenses</h3>
<p>I love code lenses almost as much as I love intellisense.&nbsp; If you&rsquo;ve never heard of it before, I am talking about the line that appears above your code telling you things like; who is referencing this piece of code, do my tests for this method fail or pass, who changed this code, what work items did they check in against etc. etc.&nbsp; Basically anything and everything you want to know about your code, right there in the context of the editor.&nbsp; It&rsquo;s a little bit like magic.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6471.image_1AEF29D1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6471.image_5F00_1AEF29D1.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/1007.image_thumb_5ABBA107.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1007.image_5F00_thumb_5F00_5ABBA107.png" alt="image" width="600" height="264" /></a></p>
<p>And if you want to drill deeper, you simply click on the code lens and you can move directly to the method that referenced this class/method etc.</p>
<p>or if you want to know what work items (in this case using Git) that this code was checked in against</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6371.image_29BBF05A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6371.image_5F00_29BBF05A.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8836.image_thumb_028437D6.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8836.image_5F00_thumb_5F00_028437D6.png" alt="image" width="600" height="270" /></a></p>
<p>Code lenses have actually been around since VS 2013 but only in the Ultimate edition, now it is available in both Professional and Enterprise and the number of available code lenses keeps growing.&nbsp; Read more about <a href="https://msdn.microsoft.com/en-us/library/dn269218.aspx">code lenses</a> here.</p>
<h3>Roslyn &ndash; or Live code analysis &ndash; or Light bulb tips</h3>
<p>The new lightning fast Roslyn compiler for C# and VB enables some really cool scenarios like live code analysis.&nbsp; This means that while you type, your code is analyzed and Roslyn comes with these neat light bulb tips suggesting ways to optimize or clean up your code.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5125.image_3FA7F35B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5125.image_5F00_3FA7F35B.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/1817.image_thumb_1633B21B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1817.image_5F00_thumb_5F00_1633B21B.png" alt="image" width="600" height="174" /></a></p>
<p>You can, if you are so inclined, also write your own special analyzers and code diagnostics to force the people on your team to always start class names with the letter c or whatever floats your boat.</p>
<h3>Peek Definition (Alt+F12) &ndash; now also in XAML</h3>
<p>One of the big productivity features in VS 2013 was to get more done without having to switch context.&nbsp; Like in this case, where I want to know how FromModel is implemented.&nbsp; I could press F12 and move to the implementation, which would open up the file where it was implemented and switch to that.&nbsp;</p>
<p>Instead here I press Alt+F12 and the FromModel implementation shows up in a peek window, and I can review and edit the code without making the file context switch.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8863.image_7135F1A1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8863.image_5F00_7135F1A1.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4186.image_thumb_333C60E3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4186.image_5F00_thumb_5F00_333C60E3.png" alt="image" width="600" height="165" /></a></p>
<p>The peek concept has grown in VS2015 and is now used in the break point IDE for example.&nbsp; But it has also expanded to XAML which gives some major productivity boosts when styling XAML since you can change the style and see the effects of the change in the designer at the same time.&nbsp;&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4527.image_22C3EFE8.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4527.image_5F00_22C3EFE8.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2287.image_thumb_302C939F.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2287.image_5F00_thumb_5F00_302C939F.png" alt="image" width="600" height="109" /></a></p>
<h3>Navigate To (Ctrl+,) &ndash; or quick search</h3>
<p>When you call a method defined in an interface, like GetCurrentWeatherAsync below, you can&rsquo;t use &ldquo;Go To Definition&rdquo; or &ldquo;Peek Definition&rdquo; since it&rsquo;ll take you to the definition in the interface (IWeatherDataAsync) rather than the implementation.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2604.image_2ADDACEE.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2604.image_5F00_2ADDACEE.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4760.image_thumb_01696BAE.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4760.image_5F00_thumb_5F00_01696BAE.png" alt="image" width="600" height="47" /></a></p>
<p>This is where Navigate To (Crtl+,) comes in handy, it allows you to really quickly navigate between the definitions and implementations of the method.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6765.image_4CCBA023.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6765.image_5F00_4CCBA023.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6646.image_thumb_6797C62F.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6646.image_5F00_thumb_5F00_6797C62F.png" alt="image" width="600" height="339" /></a></p>
<p>For more shortcuts, check out the <a href="https://msdn.microsoft.com/en-us/library/dn320181.aspx">VS Tips and Tricks</a></p>
<h3>Intellisense for a lot more scenarios</h3>
<p>There is now intellisense for XAML data binding</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7282.image_600EE773.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7282.image_5F00_600EE773.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5050.image_thumb_11334376.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5050.image_5F00_thumb_5F00_11334376.png" alt="image" width="600" height="151" /></a></p>
<p>json (for bower.json and package.json)</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6840.image_2BFF6982.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6840.image_5F00_2BFF6982.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8078.image_thumb_105D6E3D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8078.image_5F00_thumb_5F00_105D6E3D.png" alt="image" width="600" height="117" /></a></p>
<p>bootstrap css classes</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5466.image_3ACC300B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5466.image_5F00_3ACC300B.png"><img style="border-image: none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8468.image_thumb_2CFC7AC1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8468.image_5F00_thumb_5F00_2CFC7AC1.png" alt="image" width="600" height="193" /></a></p>
<p>and AngularJS directives and attributes and more&hellip;</p>
<p>You can read more about the <a href="http://weblogs.asp.net/scottgu/released-today-visual-studio-2015-asp-net-4-6-asp-net-5-ef-7-previews">HTML/ASP.NET tooling improvements here</a></p>
<p>If you feel like this list is bogus because I completely missed the best feature ever, feel free to rant about it in the comments, we are all here to learn new tips and tricks <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2538.wlEmoticon-smile_47C8A0CD.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2538.wlEmoticon_2D00_smile_5F00_47C8A0CD.png" alt="Smile" />&nbsp;</p>
<p>Tess</p>]]></content:encoded>
    </item>
    <item>
      <title>Bizzy Bees XNA to DirectX/DirectXTK – Introduction</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/bizzy-bees-xna-to-directxdirectxtk-introduction</link>
      <pubDate>Wed, 13 Aug 2014 01:12:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2014/08/13/bizzy-bees-xna-to-directxdirectxtk-introduction/</guid>
      <description><![CDATA[Since I am done holding my breath waiting for XNA to make a return I have decided to start...]]></description>
      <content:encoded><![CDATA[<p>Since I am done holding my breath waiting for XNA to make a return I have decided to start developing 2D games in DirectX instead. To get things started I sat down with my friend Johan Lindfors at <a href="http://www.coderox.se/">Coderox</a> to port my <a href="http://blogs.msdn.com/b/tess/archive/2012/03/07/10276515.aspx">XNA walkthrough</a> and in this series will basically be a direct copy of that walkthrough but using DirectX/DirectTK instead of XNA.&nbsp; The game we are going to implement is a subset of my game BizzyBees which you can download and play for <a href="http://www.windowsphone.com/en-us/store/app/bizzybees/403e83f4-9371-e011-81d2-78e7d1fa76f8">Windows Phone</a> for free.&nbsp; It&rsquo;s also available for Windows 8 written in javascript.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2061.image_749CE28E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2061.image_5F00_749CE28E.png"><img style="margin: 0px 10px 0px 0px; float: left; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2043.image_thumb_4882764E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2043.image_5F00_thumb_5F00_4882764E.png" alt="image" width="137" height="244" align="left" border="0" /></a>Bizzy Bees is super simple.&nbsp; It is raining flowers, and the task at hand is to match up same colored flowers with same colored bees to remove them before the flowers reach the bottom of the screen.&nbsp; Rainbow flowers can be matched with all bees and if you match a rainbow flower you score a point.</p>
<p>I&rsquo;ve divided the walkthrough into 8 small articles to make the information a bit more digestable</p>
<p><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-1.aspx">1. Setting up the base project with DirectX and DirectTK</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-2.aspx">2. Creating the game assets (sprites and fonts)</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-3.aspx">3. Drawing the scene &ndash; Background/Foreground/HUD</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-4.aspx">4. Adding flowers</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-5.aspx">5. Making things move</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-6.aspx">6. Adding bees</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-7.aspx">7. User Interaction</a> <br /><a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-part-8.aspx">8. Tidying up and adding finishing touches</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>If you want to follow along, you can download DirectXTK (DirectX ToolKit) <a href="https://directxtk.codeplex.com/">from codeplex</a>. DirectXTK is a toolkit that sits on top of DirectX enabling you to use XNA like constructs like the SpriteBatch, SpriteFont etc. making the transition from XNA to DirectX fairly easy and it comes directly from some of the guys that made XNA so it&rsquo;s good stuff:)</p>
<p>Disclaimer: I am not really a C++ developer since I work mainly in C# so keep that in mind when you look at the code since there might be better ways to do things.&nbsp; I welcome any and all comments that could make things better.</p>]]></content:encoded>
    </item>
    <item>
      <title>Bizzy Bees XNA to DirectX/DirectXTK – Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/bizzy-bees-xna-to-directxdirectxtk-part-2</link>
      <pubDate>Wed, 13 Aug 2014 01:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2014/08/13/bizzy-bees-xna-to-directxdirectxtk-part-2/</guid>
      <description><![CDATA[This is part of a blog series&hellip; if you came here directly you might want to read the...]]></description>
      <content:encoded><![CDATA[<p>This is part of a blog series&hellip; if you came here directly you might want to <a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-introduction.aspx">read the introduction</a> first.</p>
<p>In order to have something to draw we&rsquo;ll have to create some assets (Sprites/Direct Draw Surfaces for images and SpriteFont for fonts to draw text)&nbsp; I have drawn all my images in <a href="http://www.microsoft.com/en-us/download/details.aspx?id=36180">Expression Design</a> which you can download for free.&nbsp; It&rsquo;s an excellent vector drawing tool, kind of a light weight PhotoShop version, so it&rsquo;s great for drawing logos or small images.&nbsp;&nbsp; If you don&rsquo;t want to spend the time right now to draw stuff you can download all my images from the bottom of this article.</p>
<h1>Create sprites</h1>
<p>In order to use sprites with DirectX/DirectXTK we need to convert them to Direct Draw Surfaces by opening the png file in Visual Studio and saving it as .dds</p>
<p>If you are following the code-a-long download the images used by BizzyBees at the bottom of this page and convert them to .dds with the following names</p>
<p>BeeMap.dds <br />FlowerMap.dds&nbsp; <br />AnimatedBee.dds&nbsp;&nbsp;&nbsp; <br />Background.dds <br />Foreground.dds <br />HUD.dds</p>
<p>For the flowers and bees we&rsquo;ll use a sprite map containing several images so that we only have to load one image.&nbsp; When we draw them we will draw just a portion of the image, but I&rsquo;ll get to that later.</p>
<h1>Create SpriteFonts</h1>
<p>In XNA we could create spritefonts in Visual Studio, those spritefonts were essentially just an XML doc with info about the font.&nbsp; DirectX is a little bit different, but with the right tools it is not all that much more difficult.</p>
<p>Download the MakeSpriteFont tool from the downloads section of <a href="http://directxtk.codeplex.com">http://directxtk.codeplex.com</a>.&nbsp; This tool will let you create spritefonts that you can use with the DirectX Tool Kit</p>
<p>1. Open a command prompt and browse to the location of MakeSpriteFont.exe</p>
<p>2. Run the following command to generate a sprite font for Showcard Gothic 21pt</p>
<pre class="csharpcode">MakeSpriteFont.exe <span class="str">"Showcard Gothic"</span> MyFont.spritefont /FontSize:21</pre>
<h1>Add the assets to the project</h1>
<p>1. Open the BizzyBees project in the file explorer and add a directory under assets called Content <br />2. Add all the dds files and the spritefont to the Content directory <br />3. In Visual Studio, on the <strong>BizzyBees project</strong>, right-click and select <strong>Add-&gt;Existing Item</strong> and add all the dds files and the sprite font.&nbsp; If you want to clean it up a bit you can create a Content filter under the Assets filter and drag the new items there.&nbsp;</p>
<p>Note: In C++ the project structure with Filters may or may not reflect the actual folder structure on disk and when you load textures etc. it is the file locations on disk that rule. <br />&nbsp; <br />4. For the <strong>spritefont</strong>, change the <strong>properties</strong> in Visual Studio to <strong>Content = true</strong></p>
<p>Now we have all the assets, next we&rsquo;ll load them up and start drawing the scene</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3583.beemap_25996B13.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3583.beemap_5F00_25996B13.png"><img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="beemap" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2475.beemap_thumb_17C9B5C9.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2475.beemap_5F00_thumb_5F00_17C9B5C9.png" alt="beemap" width="546" height="91" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4555.flowermap_0E044E51.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4555.flowermap_5F00_0E044E51.png"><img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="flowermap" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8244.flowermap_thumb_41CED553.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8244.flowermap_5F00_thumb_5F00_41CED553.png" alt="flowermap" width="504" height="72" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7433.animatedbee_66850E2C.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7433.animatedbee_5F00_66850E2C.png"><img style="border: 0px currentcolor; display: inline; background-image: none;" title="animatedbee" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2577.animatedbee_thumb_6F74A06B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2577.animatedbee_5F00_thumb_5F00_6F74A06B.png" alt="animatedbee" width="180" height="72" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4503.GameScreenBackground_7F173C2D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4503.GameScreenBackground_5F00_7F173C2D.png"><img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="GameScreenBackground" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7674.GameScreenBackground_thumb_344876B3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7674.GameScreenBackground_5F00_thumb_5F00_344876B3.png" alt="GameScreenBackground" width="481" height="802" border="0" /></a><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/1754.GameScreenForeground_1F5984F1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1754.GameScreenForeground_5F00_1F5984F1.png"><img style="margin: 0px; border: 0px currentcolor; display: inline; background-image: none;" title="GameScreenForeground" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/1207.GameScreenForeground_thumb_07C1D77E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1207.GameScreenForeground_5F00_thumb_5F00_07C1D77E.png" alt="GameScreenForeground" width="481" height="802" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0045.HUDBackground_507B5042.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0045.HUDBackground_5F00_507B5042.png"><img style="border: 0px currentcolor; display: inline; background-image: none;" title="HUDBackground" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5355.HUDBackground_thumb_0BCEB601.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5355.HUDBackground_5F00_thumb_5F00_0BCEB601.png" alt="HUDBackground" width="180" height="85" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Bizzy Bees XNA to DirectX/DirectXTK – Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/bizzy-bees-xna-to-directxdirectxtk-part-1</link>
      <pubDate>Wed, 13 Aug 2014 01:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2014/08/13/bizzy-bees-xna-to-directxdirectxtk-part-1/</guid>
      <description><![CDATA[This post is part of a blog series&hellip; if you came here directly you might want to read the...]]></description>
      <content:encoded><![CDATA[<p>This post is part of a blog series&hellip; if you came here directly you might want to <a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-introduction.aspx">read the introduction</a> first.</p>
<h1>File/New Project</h1>
<p>For the purposes of this walkthrough we&rsquo;ll be creating a blank Windows Phone Direct3D app in Visual Studio.&nbsp; If you want to add menus and other items you can also try the Windows Phone Direct3D with XAML App which allows you to add in XAML pages for menus etc. but I&rsquo;ll leave that as an exercise for later:) Also, I would sincerely recommend that you read this <a href="http://www.catalinzima.com/2012/11/getting-started-with-direct3d-on-windows-phone-8-for-2d-game-development/">guide on combining DirectX with DirectXTK</a> by the creators of <a href="http://www.windowsphone.com/sv-se/store/app/chickens-can-t-fly/ce08a4c3-7ff7-4140-80c5-ab7a7031b261">Chickens can&rsquo;t fly</a> (one of the best WP games ever made in my opinion).&nbsp;&nbsp;&nbsp;</p>
<p>1. Download the latest version of <a href="http://directxtk.codeplex.com/">DirectX Tool Kit from codeplex</a></p>
<p>2. In Visual Studio, Create a new Windows Phone Direct3D app and call it BizzyBees</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6507.image_25899102.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6507.image_5F00_25899102.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/2084.image_thumb_2F763480.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2084.image_5F00_thumb_5F00_2F763480.png" alt="image" width="609" height="422" border="0" /></a></p>
<p>3. In the file explorer, copy the <strong><em>extracted DirectXTK folder</em></strong> to the <em><strong>BizzyBees solution folder</strong></em></p>
<p>4. In Visual Studio, right-click the solution and select <strong>Add-&gt;Existing project</strong> to add the <strong><em>DirectXTK_WindowsPhone8.vcxproj </em></strong>project to the solution. <br />You may notice that you have a lot of other projects here too, in fact you can use DirectXTK for a lot of different platforms like Windows 8 and XBOX and the code we are going to produce here is very similar if not the same as what you would write for other platforms.</p>
<p><br />You should now have something that looks like this:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0118.image_61FEB354.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0118.image_5F00_61FEB354.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6428.image_thumb_50B2FDD1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6428.image_5F00_thumb_5F00_50B2FDD1.png" alt="image" width="279" height="484" border="0" /></a></p>
<p>5. Open the <em><strong>BizzyBees properties window</strong></em> by right-clicking the Bizzy Bees project and selecting <strong>Properties <br /></strong>The next few steps will be performed in the properties window.</p>
<p>6. <strong><em>Link the DirectXTK project</em></strong>: Under <strong>Common Properties/References</strong> click the <strong>Add New Reference</strong> button and select the <strong>DirectXTK_WindowsPhone8</strong> project</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/0820.image_34A4CF97.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0820.image_5F00_34A4CF97.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8306.image_thumb_38B1AE1A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8306.image_5F00_thumb_5F00_38B1AE1A.png" alt="image" width="609" height="387" border="0" /></a></p>
<p>7. <strong><em>Add the DirectXTK include files</em></strong>: Under <strong>Configuration Properties/C/C++/General</strong> edit <strong>Additional Include Directories</strong> and add the <strong><em>DirectXTK\Inc</em></strong> folder</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3652.image_2A75C5DB.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3652.image_5F00_2A75C5DB.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6560.image_thumb_276367E6.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6560.image_5F00_thumb_5F00_276367E6.png" alt="image" width="609" height="416" border="0" /></a></p>
<p>8. <em><strong>Add the dxguid.lib</strong></em>:&nbsp; Under <strong>Configuration Properties/Linker/Input</strong> add <em><strong>dxguid.lib</strong></em> to <strong>Additional Dependencies</strong></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/5444.image_06DEB8E5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5444.image_5F00_06DEB8E5.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/4338.image_thumb_1F70E6E6.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4338.image_5F00_thumb_5F00_1F70E6E6.png" alt="image" width="609" height="446" border="0" /></a></p>
<p>9. Add the following includes to the pch.h file (precompile header).&nbsp; We&rsquo;ll be using items from these header files in pretty much all our classes</p>
<pre class="csharpcode">#include <span class="str">"SpriteBatch.h"</span>
#include <span class="str">"SpriteFont.h"</span>
#include <span class="str">"SimpleMath.h"</span>
#include <span class="str">"DirectXHelper.h"</span>
#include <span class="str">"DDSTextureLoader.h"</span>
#include &lt;vector&gt;
</pre>
<p>10. Build the BizzyBees Project and run it.&nbsp; For now you will just see the default cube renderer but we will clean out what we don&rsquo;t need and start building our game soon.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8883.image_6347ABEE.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8883.image_5F00_6347ABEE.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6874.image_thumb_2DD17A7A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6874.image_5F00_thumb_5F00_2DD17A7A.png" alt="image" width="138" height="244" border="0" /></a></p>
<h1>Cleaning up the project</h1>
<p>In this project CubeRenderer is pretty much where all the action happens.&nbsp; Similarly to XNA the application run goes something like this</p>
<p>A. CreateDeviceResources <br />B. CreateWindowsSizeDependentResources <br />C. Update <br />D. Render</p>
<p>Rinse and repeat C and D every frame until the game ends&hellip;&nbsp;</p>
<p>In CreateWindowsSizeDependentResources we&rsquo;ll be loading up all the textures, fonts etc. then every frame we will update the scene in Update and then blit draw the updated scene in Render.&nbsp;&nbsp; Later on we will also add user interaction but this will be event based and not part of the update/render loop.</p>
<p>1. We won&rsquo;t be needing the SimplePixelShader nor the SimpleVertexShader so remove these from the application <br />2. Rename CubeRenderer to BizzyBeeGame throughout the project.&nbsp; We could have scrapped the cube renderer and created a new class but this way we can delete stuff instead of retyping everything. <br />3. Clean up BizzyBeeGame.h and BizzyBeeGame.cpp until you only have the following</p>
<pre class="csharpcode"><span class="preproc"><strong>BizzyBeeGame.h</strong></span></pre>
<pre class="csharpcode"><span class="preproc">#pragma</span> once

#include <span class="str">"Direct3DBase.h"</span>

<span class="kwrd">ref</span> <span class="kwrd">class</span> BizzyBeeGame <span class="kwrd">sealed</span> : <span class="kwrd">public</span> Direct3DBase
{
<span class="kwrd">public</span>:
    BizzyBeeGame();

    <span class="rem">// Direct3DBase methods.</span>
    <span class="kwrd">virtual</span> <span class="kwrd">void</span> CreateDeviceResources() <span class="kwrd">override</span>;
    <span class="kwrd">virtual</span> <span class="kwrd">void</span> CreateWindowSizeDependentResources() <span class="kwrd">override</span>;
    <span class="kwrd">virtual</span> <span class="kwrd">void</span> Render() <span class="kwrd">override</span>;
    
    <span class="rem">// Method for updating time-dependent objects.</span>
    <span class="kwrd">void</span> Update(<span class="kwrd">float</span> timeTotal, <span class="kwrd">float</span> timeDelta);

<span class="kwrd">private</span>:
};

<span class="preproc"><strong>BizzyBeeGame.cpp<br /></strong></span>
#include <span class="str">"pch.h"</span>
#include <span class="str">"BizzyBeeGame.h"</span>

<span class="kwrd">using</span> <span class="kwrd">namespace</span> DirectX;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> Microsoft::WRL;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> Windows::Foundation;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> Windows::UI::Core;

BizzyBeeGame::BizzyBeeGame()
{
}

<span class="kwrd">void</span> BizzyBeeGame::CreateDeviceResources()
{
    Direct3DBase::CreateDeviceResources();
}

<span class="kwrd">void</span> BizzyBeeGame::CreateWindowSizeDependentResources()
{
    Direct3DBase::CreateWindowSizeDependentResources();
    <span class="rem">//TODO: Load textures and fonts and initialize the game</span>
}

<span class="kwrd">void</span> BizzyBeeGame::Update(<span class="kwrd">float</span> timeTotal, <span class="kwrd">float</span> timeDelta)
{
    <span class="rem">//TODO: Update the scene here</span>
}

<span class="kwrd">void</span> BizzyBeeGame::Render()
{
    <span class="kwrd">const</span> <span class="kwrd">float</span> midnightBlue[] = { 0.098f, 0.098f, 0.439f, 1.000f };
    m_d3dContext-&gt;ClearRenderTargetView(m_renderTargetView.Get(), midnightBlue);
    m_d3dContext-&gt;ClearDepthStencilView(m_depthStencilView.Get(), D3D11_CLEAR_DEPTH, 1.0f, 0);
    m_d3dContext-&gt;OMSetRenderTargets(1, m_renderTargetView.GetAddressOf(), m_depthStencilView.Get());

    <span class="rem">//TODO: Render the scene here</span>
}

  </pre>
<p><br />We removed all the 3D rendering and in the Render method we simply clear out the space and draw a midnightBlue background.&nbsp; For all you XNA devs out there, what we have done <br />now is the equivalent of starting a new Windows Phone XNA app and pressed F5 to run and see the cornflowerblue background : )</p>
<p>In the next post we&rsquo;ll generate some assets so that we have something to draw on the screen.</p>]]></content:encoded>
    </item>
    <item>
      <title>Bizzy Bees XNA to DirectX/DirectXTK – Part 4</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/bizzy-bees-xna-to-directxdirectxtk-part-4</link>
      <pubDate>Wed, 13 Aug 2014 01:10:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2014/08/13/bizzy-bees-xna-to-directxdirectxtk-part-4/</guid>
      <description><![CDATA[This is part of a blog series&hellip; if you came here directly you might want to read the...]]></description>
      <content:encoded><![CDATA[<p>This is part of a blog series&hellip; if you came here directly you might want to <a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-introduction.aspx">read the introduction</a> first.</p>
<p>&nbsp;</p>
<p>The next step is to start adding some flowers to the screen, and the way we will do this is by creating 5 columns that each hold a set of flowers.&nbsp; The reason we do this is so that each column keeps track of moving the flowers downwards and generating new flowers and also later on when you tap on a bee and then a column it will match the bottommost flower in that column to the bee to see if there is a match.</p>
<h1>Adding flowers</h1>
<p>The first thing we are going to do is generate the 5 columns and each column is going to generate 3 starting flowers.</p>
<p>1. Create a new class <strong>Column</strong> (uncheck the Windows Store checkbox when you create the class).&nbsp;</p>
<p>2. Add a few new methods, some constants and Fields to the class</p>
<pre class="csharpcode"><span class="preproc">#pragma</span> once

<span class="kwrd">using</span> <span class="kwrd">namespace</span> std;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> DirectX;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> Microsoft::WRL;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> DirectX::SimpleMath;

<span class="kwrd">class</span> Column
{
<span class="kwrd">public</span>:
    Column(<span class="kwrd">float</span> x);
    ~Column();
    <span class="kwrd">void</span> Draw(shared_ptr&lt;SpriteBatch&gt; spriteBatch, ComPtr&lt;ID3D11ShaderResourceView&gt; texture);
    <span class="kwrd">float</span> X;
<span class="kwrd">private</span>:
    <span class="kwrd">static</span> <span class="kwrd">const</span> <span class="kwrd">int</span> columnTop = 150;
    <span class="kwrd">static</span> <span class="kwrd">const</span> <span class="kwrd">int</span> numColors = 6;
    <span class="kwrd">static</span> <span class="kwrd">const</span> <span class="kwrd">int</span> flowerDeltaY = 80;
    <span class="kwrd">static</span> <span class="kwrd">const</span> <span class="kwrd">int</span> flowerSize = 72;
    <span class="kwrd">static</span> <span class="kwrd">const</span> <span class="kwrd">int</span> rainbowColor = 6;

    vector&lt;shared_ptr&lt;Flower&gt;&gt; flowers;

    <span class="kwrd">void</span> AddRandomFlower(<span class="kwrd">float</span> y);
};</pre>
<p>The Column class contains the following:</p>
<ul>
<li>X &ndash; marking the position of the column x-wise</li>
<li>Draw method &ndash; that will draw the flowers on the screen</li>
<li>AddRandomFlower method that will and a random colored flower to the column</li>
<li>a vector (list) of flowers</li>
<li>a number of constants that will allow us to space and position the flowers on the screen, and also some constants used to generate the colors,</li>
</ul>
<p>3. Add a <strong>Flower</strong> class. The Flower class doesn&rsquo;t have any methods just information about where it is located and the color of the flower</p>
<pre class="csharpcode"><span class="kwrd">class</span> Flower
{
<span class="kwrd">public</span>:
    Flower(Vector2 position, <span class="kwrd">int</span> color);
    Vector2 Position;
    <span class="kwrd">int</span> Color;
};
</pre>
<p>4. Implement the <strong>Column</strong> methods like this:</p>
<pre class="csharpcode">Column::Column(<span class="kwrd">float</span> x) : X(x)
{
    AddRandomFlower(columnTop + 2 * flowerDeltaY);
    AddRandomFlower(columnTop + flowerDeltaY);
    AddRandomFlower(columnTop);
}

Column::~Column()
{
}

<span class="kwrd">void</span> Column::Draw(shared_ptr&lt;SpriteBatch&gt; spriteBatch, ComPtr&lt;ID3D11ShaderResourceView&gt; texture){
    <span class="kwrd">for</span> (auto pFlower = begin(flowers); pFlower != end(flowers); pFlower++){
        auto flower = (*pFlower);
        RECT flowerMapRect = { flower-&gt;Color * flowerSize, 0, (flower-&gt;Color + 1) * flowerSize, flowerSize };
        spriteBatch-&gt;Draw(texture.Get(), flower-&gt;Position, &amp;flowerMapRect, Colors::White);
    }
}

<span class="kwrd">void</span> Column::AddRandomFlower(<span class="kwrd">float</span> y){
    <span class="kwrd">int</span> color = rand() % (numColors + 1);
    flowers.push_back(make_shared&lt;Flower&gt;(Vector2(X,y), color));
}</pre>
<p>and the Flower constructor like this</p>
<pre class="csharpcode">Flower::Flower(Vector2 position, <span class="kwrd">int</span> color) : Position(position), Color(color){}</pre>
<p>&nbsp;</p>
<p>When a new column is created it generates 3 flowers spaced <strong>flowerDeltaY</strong> apart.&nbsp; <strong>AddRandomFlower</strong> randomizes the color, generates a new flower and adds it to the flowers list.</p>
<p>Finally the <strong>Draw</strong> method loops through the flowers and draws them.&nbsp; The only difference here between this draw and what we have seen before is that we only draw a portion (rectangle) of the texture specified by the flowerMapRect (left, top, right, bottom).</p>
<p>Just one more little comment, we specify Colors::White here (it has been omitted earlier). This means that we are going to shine a white light on the texture essentially leaving it intact.&nbsp; If we want a blue tint on the texture we can change this to Colors::Blue for example.</p>
<p>5. Add code to the <strong>BizzyBeeGameResetGame</strong> method to initialize the columns and randomize (using the current time as the seed) so that we won&rsquo;t generate the same flowers every run.&nbsp; In order to use the <strong>time </strong>we&rsquo;ll also have to <strong>#include &lt;time.h&gt;</strong></p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::ResetGame(){
    <span class="rem">//RANDOMIZE</span>
    srand((unsigned)time(NULL));

    <span class="rem">//INITIALIZE COLUMNS</span>
    columns.clear();
    <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; 5; i++)
        columns.push_back(make_shared&lt;Column&gt;(i * 92 + 22));
}</pre>
<p>6. In <strong>BizzyBeeGame::DrawFlowers</strong> &ndash; loop through and draw the columns</p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::DrawFlowers(){
    <span class="kwrd">for</span> (auto columnPtr = begin(columns); columnPtr != end(columns); columnPtr++)
        (*columnPtr)-&gt;Draw(spriteBatch, flowerMapTexture);
}</pre>
<p>7. Run the app. Now we should be getting closer.&nbsp; It doesn&rsquo;t really do much yet but display some flowers but that will change shortly</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8203.image_7F934933.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8203.image_5F00_7F934933.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/1205.image_thumb_3121477A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1205.image_5F00_thumb_5F00_3121477A.png" alt="image" width="138" height="244" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Bizzy Bees XNA to DirectX/DirectXTK – Part 5</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/bizzy-bees-xna-to-directxdirectxtk-part-5</link>
      <pubDate>Wed, 13 Aug 2014 01:10:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2014/08/13/bizzy-bees-xna-to-directxdirectxtk-part-5/</guid>
      <description><![CDATA[This is part of a blog series&hellip; if you came here directly you might want to read the...]]></description>
      <content:encoded><![CDATA[<p>This is part of a blog series&hellip; if you came here directly you might want to <a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-introduction.aspx">read the introduction</a> first.</p>
<p>&nbsp;</p>
<p>Animating objects in DirectX is just as simple as in XNA.&nbsp; In the update method we just change the position of the objects and since they are drawn every frame with their respective positions they will start moving.</p>
<p>If you want to create some more advanced animations, like if we would want the bees to flap their wings, you would create sprite maps with images of the various states and then just swap which portion of the sprite map you want to display each time.</p>
<h1>Animating the flowers</h1>
<p>The flowers are going to move down at a steady pace.&nbsp; We&rsquo;ll move them down at 0.4 pixels per frame (at least initially).&nbsp; The 0.4 is an arbitrary number that I have picked by testing the app on my family until I found a speed that seemed good.</p>
<p>1. Add a new public member variable on the Column class called <strong>Velocity</strong> (float).</p>
<p>2. In the constructor for Column, set Velocity to 0.4f;</p>
<pre class="csharpcode">Column::Column(<span class="kwrd">float</span> x) : X(x), Velocity(0.4f)
{
...</pre>
<p>3. Add a public <strong>void Update()</strong> method to Column and implement it so that it increases the Y position of all the flowers by Velocity. i.e. moving the flowers 0.4 pixels down per frame</p>
<pre class="csharpcode"><span class="kwrd">void</span> Column::Update(){
    <span class="kwrd">for</span> (auto pFlower = begin(flowers); pFlower != end(flowers); pFlower++){
        auto flower = (*pFlower);
        flower-&gt;Position.y += Velocity;
    }
}</pre>
<p>4. Add a private <strong>void UpdateColumns()</strong> method to the <strong>BizzyBeeGame</strong> class and call this from the <strong>BizzyBeeGame::Update</strong> method</p>
<p>5. The <strong>BizzyBeeGame::UpdateColumns</strong> should look like this, just looping through the columns and updating each one</p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::UpdateColumns(){
    <span class="kwrd">for</span> (auto columnPtr = begin(columns); columnPtr != end(columns); columnPtr++)
        (*columnPtr)-&gt;Update();
}
</pre>
<p>6. Save and run</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/6521.image_47B26291.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6521.image_5F00_47B26291.png"><img style="margin: 0px 10px 0px 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3833.image_thumb_42D23F86.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3833.image_5F00_thumb_5F00_42D23F86.png" alt="image" width="138" height="244" border="0" /></a></p>
<p>The flowers now slowly move downward until they move off the screen.&nbsp; And they are never replenished.&nbsp; We&rsquo;ll need to do something to fix this.</p>
<h1>Game Over</h1>
<p>When the flowers reach the bottom, the game is over so we&rsquo;ll have to keep track of this</p>
<p>1. Add a new private member variable to the BizzyBeeGame class called <strong>bool GameOver </strong>and set it to <strong>false</strong> in the <strong>ResetGame</strong> method</p>
<p>2. Change the <strong>BizzyBeeGame::UpdateColumns</strong> to return a <strong>bool</strong> and change it to check for if the column has reached the bottom of the flower area</p>
<pre class="csharpcode"><span class="kwrd">bool</span> BizzyBeeGame::UpdateColumns(){
    <span class="kwrd">bool</span> reachedBottom = <span class="kwrd">false</span>;

    <span class="kwrd">for</span> (auto columnPtr = begin(columns); columnPtr != end(columns); columnPtr++){
        auto column = (*columnPtr);
        column-&gt;Update();
        <span class="kwrd">if</span> (column-&gt;HasReachedBottom())
            reachedBottom = <span class="kwrd">true</span>;
    }
    <span class="kwrd">return</span> reachedBottom;
}</pre>
<p>3. In the <strong>BizzyBeeGame::Update</strong> method, only update if it&rsquo;s not <strong>GameOver</strong>, and also set the <strong>GameOver</strong> variable if we reached the bottom</p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::Update(<span class="kwrd">float</span> timeTotal, <span class="kwrd">float</span> timeDelta)
{
    <span class="kwrd">if</span> (!GameOver){
        <span class="kwrd">if</span> (UpdateColumns()){
            GameOver = <span class="kwrd">true</span>;
        }
    }
}</pre>
<p>4. In order to check if the first flower reached the bottom we&rsquo;ll have to add a static <strong>const int columnBottom = 620; </strong>to the <strong>Column</strong> class, and check the first flowers y position against it</p>
<pre class="csharpcode"><span class="kwrd">bool</span> Column::HasReachedBottom(){
    <span class="kwrd">if</span> (flowers.size() &gt; 0 &amp;&amp; flowers[0]-&gt;Position.y &gt;= columnBottom)
        <span class="kwrd">return</span> <span class="kwrd">true</span>;
    <span class="kwrd">else</span>
        <span class="kwrd">return</span> <span class="kwrd">false</span>;
}</pre>
<p>5. Finally we need to change the drawing so that we print out the game over message.&nbsp; In the <strong>BizzyBeeGame::Render </strong>method, check for <strong>GameOver </strong>and call <strong>DrawGameOver</strong> right before the spriteBatch-&gt;End() call</p>
<pre class="csharpcode">    <span class="kwrd">if</span> (GameOver)
        DrawGameOver();
</pre>
<p>6. In the <strong>BizzyBeeGame::DrawGameOver</strong> we&rsquo;ll simply print the string <strong>GAME OVER</strong> twice (once in red and once in black) with a little offset to get a more gamey effect</p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::DrawGameOver(){
    DrawString(L<span class="str">"GAME OVER"</span>, Vector2(79, 404), Colors::Black, 2.0f);
    DrawString(L<span class="str">"GAME OVER"</span>, Vector2(75, 400), Colors::Red, 2.0f);
}</pre>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/3323.image_4D25F497.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3323.image_5F00_4D25F497.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8880.image_thumb_5E98E620.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8880.image_5F00_thumb_5F00_5E98E620.png" alt="image" width="137" height="244" border="0" /></a></p>
<p>YAY! so now we can loose&hellip; too bad you can&rsquo;t win:)&nbsp; oh well&hellip; we&rsquo;ll take care of that too later</p>
<h1>Creating a Flower Factory</h1>
<p>The game would get a bit boring if we only had 3 flowers per column so to fix that we&rsquo;ll generate new flowers as the flowers move down.&nbsp;</p>
<p>1. In Column::Update add code to the bottom of the function to check if we have an empty column, or if the top flower has moved down past the column top, and if so add a new flower</p>
<pre class="csharpcode">    <span class="rem">//generate new flowers if we need to</span>
    <span class="kwrd">if</span> (flowers.size() == 0 || (flowers[flowers.size() - 1]-&gt;Position.y &gt; columnTop))
        AddRandomFlower(columnTop - flowerDeltaY);
</pre>
<p>That is all there is to it. We are done with the flowers!&nbsp; next time we&rsquo;ll add some bees to the mix as well.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7183.image_298EE7A1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7183.image_5F00_298EE7A1.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7120.image_thumb_7D747B60.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7120.image_5F00_thumb_5F00_7D747B60.png" alt="image" width="137" height="244" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Bizzy Bees XNA to DirectX/DirectXTK – Part 3</title>
      <link>https://docs.microsoft.com/archive/blogs/tess/bizzy-bees-xna-to-directxdirectxtk-part-3</link>
      <pubDate>Wed, 13 Aug 2014 01:10:00 GMT</pubDate>
      <dc:creator><![CDATA[Tess Ferrandez]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tess/2014/08/13/bizzy-bees-xna-to-directxdirectxtk-part-3/</guid>
      <description><![CDATA[This is part of a blog series&hellip; if you came here directly you might want to read the...]]></description>
      <content:encoded><![CDATA[<p>This is part of a blog series&hellip; if you came here directly you might want to <a href="http://blogs.msdn.com/b/tess/archive/2014/08/13/bizzy-bees-xna-to-directx-directxtk-introduction.aspx">read the introduction</a> first.</p>
<h1>Drawing the Scene</h1>
<p>Now we have all our assets and it&rsquo;s time to draw them on the screen.&nbsp;</p>
<p>In order to draw something we&rsquo;ll need</p>
<p>a) something to draw &ndash; which is going to be our dds sprites (or textures) <br />b) a start position</p>
<p>In our game we&rsquo;ll draw the following things on the screen</p>
<ul>
<li>The <strong>Background</strong> at <strong>0,0</strong> where <strong>0,0</strong> is the top left corner</li>
<li>The <strong>Flowers</strong> and <strong>Bees</strong> but we&rsquo;ll get to those later</li>
<li>The <strong>Foreground</strong> at <strong>0,0</strong> as well.&nbsp; We can look at it as a puppet show where the foreground will sit on top of the area where we draw the flowers so that when they drop down they will clip behind the edges of the foreground texture</li>
<li>The <strong>HUD</strong> (Heads Up Display) which will be a <strong>HUD background</strong> painted at <strong>7,7</strong> (7 pixels from the top and 7 pixels from the left).&nbsp; When painting the HUD we&rsquo;ll also print out the <strong>score</strong>, the <strong>level name</strong> (in this case MARATHON), some <strong>game instructions</strong> as well as bees indicating how many <strong>lives</strong> we have left.</li>
<li>A <strong>GAME OVER</strong> text on top of the whole scene when the game is lost</li>
</ul>
<h1>Getting things started in the BizzyBeeGame class</h1>
<p>1. Add the following methods and member variables in the <strong>BizzyBeeGame.h</strong> file</p>
<pre class="csharpcode"><span class="kwrd">private</span>:
    shared_ptr&lt;SpriteBatch&gt; spriteBatch;

    <span class="rem">//Textures</span>
    ComPtr&lt;ID3D11ShaderResourceView&gt; backgroundTexture;
    ComPtr&lt;ID3D11ShaderResourceView&gt; foregroundTexture;
    ComPtr&lt;ID3D11ShaderResourceView&gt; hudBackgroundTexture;
    ComPtr&lt;ID3D11ShaderResourceView&gt; flowerMapTexture;
    ComPtr&lt;ID3D11ShaderResourceView&gt; beeMapTexture;<br />    ComPtr&lt;ID3D11ShaderResourceView&gt; lifeBeeTexture;

    <span class="rem">//Fonts</span>
    shared_ptr&lt;SpriteFont&gt; hudFont;
</pre>
<pre class="csharpcode"><span class="kwrd"> void</span> ResetGame();

</pre>
<pre class="csharpcode">    <span class="rem">//Draw functions</span>
    <span class="kwrd">void</span> DrawBackground();
    <span class="kwrd">void</span> DrawFlowers();
    <span class="kwrd">void</span> DrawBees();
    <span class="kwrd">void</span> DrawForeground();
    <span class="kwrd">void</span> DrawHUD();
    <span class="kwrd">void</span> DrawGameOver();

    <span class="kwrd">void</span> DrawString(<span class="kwrd">const</span> wchar_t* text, Vector2 position, XMVECTOR color);
    <span class="kwrd">void</span> DrawString(<span class="kwrd">const</span> wchar_t* text, Vector2 position, XMVECTOR color, <span class="kwrd">float</span> scale);</pre>
<p>Right under #include &ldquo;Direct3DBase.h&rdquo; add the following using directives in order to be able to use things like shared_ptr, Vector2 etc.</p>
<pre class="csharpcode"><span class="kwrd">using</span> <span class="kwrd">namespace</span> std;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> DirectX::SimpleMath;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> DirectX;
<span class="kwrd">using</span> <span class="kwrd">namespace</span> Microsoft::WRL;</pre>
<p>So now we have defined</p>
<ul>
<li>pointers to all the textures and fonts we&rsquo;ll use.&nbsp;</li>
<li>a sprite batch which we will use to draw items to the screen</li>
<li>a number of draw methods where we will actually draw all the items described above</li>
<li>Two drawstring methods (one for regular text and one if we want to scale the text).&nbsp; Typically you would create different sprite fonts for different text sizes but I am doing it this way for simplicity.&nbsp; Scaling a font will make it a bit grainy.</li>
</ul>
<p>2. In <strong>BizzyBeeGame.cpp</strong> implement all the new methods but let them be empty for now</p>
<p>3. In the <strong>BizzyBeeGame::Render</strong> method add the folloiwng code to start drawing the scene.&nbsp; Note that all the drawing has to occur between spriteBatch-&gt;Begin() and spriteBatch-&gt;End()</p>
<pre class="csharpcode">    <span class="rem">//Draw the scene</span>
    spriteBatch-&gt;Begin();
    DrawBackground();
    DrawFlowers();
    DrawBees();
    DrawForeground();
    DrawHUD();
    spriteBatch-&gt;End();
</pre>
<p>4. So far so good, but nothing gets drawn on the screen : ) We&rsquo;ll have to set up the spriteBatch and load our textures and fonts first in <strong>BizzyBeeGame::CreateWindowSizeDependentResources</strong></p>
<pre class="csharpcode">    auto device = m_d3dDevice.Get();
    auto context = m_d3dContext.Get();

    spriteBatch.reset(<span class="kwrd">new</span> SpriteBatch(context));

    <span class="rem">//TODO: Load textures </span>
    DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L<span class="str">"Assets\\Content\\Background.dds"</span>, nullptr, backgroundTexture.ReleaseAndGetAddressOf()));
    DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L<span class="str">"Assets\\Content\\Foreground.dds"</span>, nullptr, foregroundTexture.ReleaseAndGetAddressOf()));
    DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L<span class="str">"Assets\\Content\\HUD.dds"</span>, nullptr, hudBackgroundTexture.ReleaseAndGetAddressOf()));
    DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L<span class="str">"Assets\\Content\\FlowerMap.dds"</span>, nullptr, flowerMapTexture.ReleaseAndGetAddressOf()));
    DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L<span class="str">"Assets\\Content\\BeeMap.dds"</span>, nullptr, beeMapTexture.ReleaseAndGetAddressOf()));</pre>
<pre class="csharpcode">    DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L<span class="str">"Assets\\Content\\AnimatedBee.dds"</span>, nullptr, lifeBeeTexture.ReleaseAndGetAddressOf()));
</pre>
<pre class="csharpcode">    <span class="rem">//TODO: Load fonts</span>
    hudFont.reset(<span class="kwrd">new</span> SpriteFont(device, L<span class="str">"Assets\\Content\\MyFont.spriteFont"</span>));

    <span class="rem">//TODO: Initialize the game</span>
    ResetGame();</pre>
<p>The code here is pretty straight forward, just keep in mind that this loads from the Assets\Content folder on disk, independently of how the filters are set up in the project.</p>
<p>5. Now we have the assets so let&rsquo;s start drawing them.&nbsp; The <strong>BizzyBeeGame::DrawBackground</strong> method will look like this, which means, we draw the backgroundTexture at position 0,0.&nbsp;</p>
<pre class="csharpcode">    spriteBatch-&gt;Draw(backgroundTexture.Get(), Vector2(0, 0));
</pre>
<p>6. Implement <strong>BizzyBeeGame::DrawForeground</strong> the same way but with the foregroundTexture</p>
<p>7. For the <strong>HUD</strong> we need to print some things so let&rsquo;s first implement the <strong>DrawString</strong> methods</p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::DrawString(<span class="kwrd">const</span> wchar_t* text, Vector2 position, XMVECTOR color){
    DrawString(text, position, color, 1.0f);
}
<span class="kwrd">void</span> BizzyBeeGame::DrawString(<span class="kwrd">const</span> wchar_t* text, Vector2 position, XMVECTOR color, <span class="kwrd">float</span> scale){
    hudFont-&gt;DrawString(spriteBatch.get(), text, position, color, 0.0f, g_XMZero, scale);
}</pre>
<p>8. Implement the DrawHUD method, and draw the background, the level name (MARATHON) and instructions (COLLECT RAINBOW FLOWERS).&nbsp; The text is blue and the level name is slightly smaller than the instruction text</p>
<pre class="csharpcode"><span class="kwrd">void</span> BizzyBeeGame::DrawHUD(){
    spriteBatch-&gt;Draw(hudBackgroundTexture.Get(), Vector2(7, 7));
    DrawString(L<span class="str">"MARATHON"</span>, Vector2(40, 10), Colors::Blue, 0.7f);
    DrawString(L<span class="str">"COLLECT RAINBOW FLOWERS"</span>, Vector2(45, 115), Colors::Blue);
}
</pre>
<p>9. Compile and run.&nbsp; you should now se something like this on the screen</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/8688.image_002B17EA.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8688.image_5F00_002B17EA.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/55/89/metablogapi/7418.image_thumb_38D852A8.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7418.image_5F00_thumb_5F00_38D852A8.png" alt="image" width="138" height="244" border="0" /></a></p>
<p>It&rsquo;s not terribly exciting quite yet but in the next few steps we&rsquo;ll add on all the game components</p>
<pre class="csharpcode">&nbsp;</pre>]]></content:encoded>
    </item>
  </channel>
</rss>