 Turn it on. Ah! Now it's green. It works! Like a charm. Do you have a mic or something? No, worked out of the box. This is not a Windows platform. I don't have a microphone. The mic is for recording. Okay, stay close. Yeah, yeah. Okay, that's good. Hello, good afternoon. Hi, everybody. My name is Tom the same, and I'm a Red Hatter working on .NET Core. In this talk, we'll explore what .NET Core is and we'll zoom in to the open source and cross-platform aspects. At the end of the presentation, I'll be joined by Jeff, who's a program manager on the ASP.NET team. So, let me begin by explaining what .NET Core is. So, most of you will know the .NET framework. The .NET framework is the development platform Microsoft first released about 15 years ago. It's the de facto programming platform for building Windows GUI applications and Windows web applications. Shortly after Microsoft first released the .NET framework, an open source and cross-platform implementation came about. Of course, I'm talking about Mono. And Mono has allowed us to develop and run .NET applications on Linux for many years. The Mono project or, yes, the Mono project is led by Xamarin and Xamarin was acquired by Microsoft about a year ago and Xamarin provides a .NET platform for building mobile applications. .NET Core is a new .NET platform intended to build cross-platform services. Let me zoom into that. So, .NET Core is cross-platform. It runs on Windows, Linux and Mac. It's completely open source. This includes the runtime, the class library, compiler and all the tooling. So, the source code is available and it's also open for contribution. It's very fast. Some of you may have attended Jeff's talk this morning where he mentioned ASP.NET Core is capable of handling millions of requests per second. Such performance is only achieved by making it a clear goal and by optimizing throughout the entire stack with the runtime, the class library and also the compiler and every optimization made there is beneficial for all apps running on .NET Core. .NET Core is also ideal for micro-surface development because it's fast and also because you can build really small micro-services. This is possible because applications can trim their dependencies. If you attend Nimanja's talk later you can build a really minimal MVC application and also the runtime itself only weighs about 50 megabytes so deploying .NET Core-based micro-services comes at really low overhead. The main programming languages of the .NET Platform are C-Sharp, F-Sharp and VB. C-Sharp is a modern general-purpose programming language. It's the most popular programming language of the .NET Platform. Most open source projects you see out there are written in C-Sharp. F-Sharp is a functional programming language and VB is an easy approachable general-purpose programming language. Because we have multiple platforms we need a way of writing codes and target all of them. This is where .NET Standard comes in. .NET Standard is an API definition and libraries will target that API and then the platforms implement the API which makes the library run on the different platforms. Making this a little more concrete the columns of this table show the different versions of .NET Standard and each successive version adds more APIs. So suppose we write a library which is targeting .NET Standard 1.3 that library would run on .NET Core 1.0 and it would run on the .NET framework 4.6. If in our library we would like to use newer APIs available in .NET Standard 1.4, 1.5 or 1.6 our library would no longer work on the .NET framework. The next version of .NET Standard is .NET Standard 2.0 and it will be implemented by .NET Core which will be shipped in spring this year and it will bring a much larger common API surface between .NET Core and .NET Core. What also will be possible is that .NET Standard libraries will be able to use other libraries which are not yet .NET Standard aware but which would be .NET Standard compliant. All in all this means that porting applications from the .NET framework to .NET Core will become much easier and it will also be possible to share much more code that runs on all of the platforms. The next version of .NET Standard 2.0 contains really a lot of useful stuff and what's interesting to know is that some of these things were already in .NET Core but not yet in .NET Standard. For example, the threat class was available in .NET Core but because it wasn't in .NET Standard it was not possible to write a library that used the threat class which were across the different platforms. This will now be possible thanks to .NET Standard 2. As I mentioned, .NET Core is open source so the source code lives on GitHub, it's MIT licensed and it's copyright of the .NET Foundation. The .NET Foundation is a non-profit organization and it's here to help support the .NET open source ecosystem. The technical steering group includes Microsoft but other companies are also part of it like Red Hat, Samsung and Google. The binary is built by Microsoft for the Linux platforms but also MIT licensed. These pictures come from blog posts by Matt Warren where he looks at the .NET .NET Core open source journey for the past two years. Each of these graphs represent activity. Each bar is one month of activity and they start in November 2014 and go till October 2016. On the left you see the runtime and on the right you see the class library. The top row is the number of issues created and the bottom part is the number of pull requests. You see a clear increase for all of these graphs but also indicated per bar is the darker part, this is community contributions and the lighter part this is Microsoft contribution. So you see the community is also active actively creating issues and also pull requests and you look at the absolute numbers of these graphs they are quite high for example for the class library there in October 2016 there were 500 pull requests which is a pretty nice number and for the runtime there were 250 pull requests. So .NET Core is cross platform for .NET Core 1.1 there are binaries provided by Microsoft for a number of popular Linux distributions and for Mac as well. At Red Hat we also build .NET Core and we provide it for REL and for OpenShift. For REL it's available as part of the no cost developer subscription and we closely follow the upstream releases. This means when Microsoft releases their upstream version of .NET Core only a few days later it's already available on REL as well. So as I said the packages are built by Red Hat and they're provided as a software collection so you can install them on your system and it won't impact the rest of your system and you just activate them and you need them. The commands show you how to enable the subscription install .NET Core and then enable the software collection. We also provide a source to ImageBuilder for OpenShift. This means you can hand your source code in a Git repository to OpenShift and OpenShift will build your .NET code and then deploy it. Doing this is as easy as this one-liner commander at the bottom where you specify the runtime you're targeting so in this case .NET Core 1.1 you give your Git repository with its source code and then you specify where the startup project is inside this Git repository. After issuing this command OpenShift will pull your code compile it and then deploy it in a container. The next story is even getting more interesting for .NET Core 2. Microsoft will provide a Linux X64 build and this will allow us to develop applications and publish them standalone and they will run on, let's say, all the popular Linux distros out there without there being a .NET installer or a .NET runtime specifically for that distribution. So this is a pretty nice feature and then also very interesting distro maintainers building from the source code will become a lot easier so if you're building .NET Core thanks to changes made to the repository layout and to build artifacts building from source will become easier. Now it's demo time so Jeff will join me and he'll first demonstrate a web application running in a visual studio on Windows and then he'll publish that standalone so I can run it on my Fedora machine. Got to get some display. You'd like to see what I'm actually doing on my laptop, wouldn't you? That'd be nice. Fantastic. Very cool. Alright. So here I am on Windows. I know Windows, right? I mean but I have visual studio 2015. This is the community edition. It's a free version that's available for hobbyists and for small companies that are in startup mode and what I'm going to do is I'm going to open the web application that Tom gave me I have it sitting right here and this is the source code that he started with. So I'm going to open that here in visual studio and in just a second it's going to come back do a little bit of conversion and I will have my project open. So now it's going through and you can see on the bottom it's installing packages. We have packages that we use just like you guys have on Red Hat that have all the different components, little modules as part of the .NET framework .NET core framework. And you can also see over here on the right it's restoring other dependencies that's because inside of visual studio we also restore those client side dependencies for Bower and NPM automatically for you as you make changes to your Bower JSON and package JSON files. So it's going to go and finish bringing back all the necessary things that I need to make my client side web application work. Now, while that's finishing up here I can actually tell visual studio to build my application. I just went through and used the hotkey for build and then build application here. And you didn't even see it because it's actually still waiting. But what it'll do is it'll dump here into my output window the results of what happens during my build process. Fighting the network again. We're good. Of course NPM is going to take a while to install. I have all kinds of other windows here inside of visual studio that I can use to see what's going on. There we go. We can see it's starting to bring some of these things back. I can actually look and see what's going on with my package manager and I can watch what those things are doing over here. This is for the .NET packages, my NuGet packages. So I'm going to go over here to my output and not that one. There it is. So you can see that it finished building, the actual build of my .NET code took only 1.9 seconds. Pretty fast. A lot faster and it took the download of that JavaScript. But here locally on my windows machine I can start my application and use the native windows server, IIS express. This is a developer focused web server that I can attach to and debug with without needing administrator privileges on my machine. So I click play and it'll compile and show me my application in this case running in edge because I'm running windows 10. Everybody okay with edge? Chrome? Firefox? Okay. One person likes Firefox. Nobody else likes Chrome. So I have this simple templated website put together that Tom sent me and I can come through and I can make some changes and what not. But really what I want to do here is I want to maybe do some debugging and that's easy for me to do with Visual Studio and I have these features also in Visual Studio Code. I can go into my controllers where I have some C sharp code written and I can actually look at all the different code here and if I want to pause the action I can put a break point let's say right here where it's going to return the view right in the MVC framework we have a controller, we have a view and we have a model well in this case there's no model we just have a view that some templated C sharp and HTML that we call razor and we're going to return the view information for this index action inside of my home controller. So that view actually lives here under my views folder under home and it's called index makes sense it's designed by convention the name of my controller, the name of my razor file sitting out here and you can see it looks just like like standard HTML and it's got some some C sharp that's mixed in with it where is it? Up here at the top you can see surrounded by this at symbol okay this is C sharp code that's being executed and then it will be dropped in a little bit later anywhere that I use that at sign, a context switch and I flip from HTML to C sharp and as soon as C sharp code is done executing it'll actually change context back to HTML again I think you can see that better in the layout of this template there you go so here's some HTML with title tag and then some C sharp it's in this gray highlight it's kind of hard to see on the projector and then it changes back to HTML context and that's a feature of our razor templating engine that we use but I'm going to put this break point in here because I want to be able to inspect what's going on inside of my web browser my web server, I'm sorry because my break points occur server side so this will start up and visual studio attaches and shows me here's where we're stopped at I have some locals that I can look at and actually watch the state of the interaction with my web server so I can look at the URL that was requested the information about the HTTP context that was passed to my session and I can inspect and see exactly what's going on right here inside of visual studio there's other tools that we have built into other versions of visual studio that will allow me to profile and take a look at everything that's loaded into memory or where the processor is actually doing its work so that I can find those hotspots and tune my application easily so so this is on visual studio that runs on windows you can attach to a linux machine that's running and debug and profile over there so but you need to be running with the full version of the IDE so we can also run this version of the tool and attach to a docker container that's running running a linux image and be able to debug and profile what's going on inside of that very cool options that we have available so that's nice that I can come through and I can take a look at this the last thing that I wanted to show you is inside of visual studio and this is the same for all of our visual studio versions including code we have this great feature that we call IntelliSense and it's not like that type ahead stuff that you can see in sublime where it sees other things that were completed in your code and it tries to figure out something that matches we actually on the fly compile your code and then inspect and give you features that are available with your code so if I do things in here like if I have a var I equals 0 so I is clearly an integer and I say I dot zoom in there you can see I get I get integer like things that I can do with this but if I change I to a string and I look at what's here now I have string things that I can do with this variable okay so it's clearly actually compiling the code and giving me appropriate options for interacting with that with that variable so very cool features and like I said you do get those in visual studio code that runs on all platforms but you know if this application looks like it's running pretty well I want to compile it and make it available so that Tom can run it back on his red hat machine so what I can do is I can go into that folder and I'm going to navigate down to the actual application let me pump up the font size here just a little bit so now everything with the dotnet framework runs with the dotnet core and SDK runs on the command line it runs command line first and then we build visual studio on top of it so that everybody gets the same feature set regardless of what tool they're using so you run the command line but just calling dotnet and then a series of commands that you pass in so I'll call dotnet build it knows that it was modified compiles and it's done and now I'm going to publish it so that it's available for use on fedora in order for me to do that I'm going to come through here and make sure that all of my appropriate content is available and deployed so everything that would be in the dotnet core framework that's installed locally on my windows machine needs to be bundled up and shifted, shipped not shifted shipped with my application so that Tom can use it so what I do is I'm going to change this reference to the dotnet core app instead of it being a platform a platform is something that's installed locally and shared across many projects I'm going to remove that so that it's actually packaged and brought with my application and then I'm going to scroll down to the bottom here and I'm going to add another segment to specify the run times that I'm going to support so what I do it's even helping me here with some type of run times and I'm going to specify two run times I'm going to specify win7x64 because my machine is a windows 7 variant here so I need to still be able to compile for my machine and then Tom yours is fedora24 so let's reference fedora24 and that's x64 so I'll say x64 and now I can you can see over here I made the change and Visual Studio is restoring the appropriate packages to support fedora24 I can take a look and I can see exactly what it's doing and what's even better about these little console windows you can scroll up and see exactly the command that it executed so it set the path and then here it said .NET restore and it specified some place to write some output to so it's all done it restored everything so I will .NET build one more time there it goes good everything built now I can publish publish is what's going to do that I'm going to specify a run time of all my references and make it available in one folder so I say let's move this up to the top .NET publish and then I'm going to specify a run time because I need to actually say that I'm not publishing for this machine and this run time publishing for a different one and I can pass in a collection of run times if I wanted or specify one that I don't necessarily support with this machine like fedora I wanted to but in this case let's specify fedora fedora 24 x64 so it's going to publish that and carry along the appropriate run time for me now that it's done building here it goes so it's gone through it's marked everything up and now it's sitting down here in this folder so let's just show you what that folder looks like it's under bin, debug netcore app and take a look I've actually got a win7 one sitting here but if I look in fedora 24x64 these are the things to install if I only I'm sorry if I had a .NET run time on my machine but I've got everything necessary right here my views, my static files that live in the dub dub dub root folder and all my DLLs that I need to ship so this is the part where I do the Julia child fake out and look I'm already done baking the kick I've actually already packaged this up and I've sent a zip over to Tom so he can show you what happens after he receives this publish folder so as Jeff was writing the train to Burnu he sent me the zip file that he created just as he demonstrated before so I have it here the fedora 24 zip and I will just unzip it everything is in there so by removing the type platform from the project Jason Jeff ensured this was a standalone .NET application which means I don't need .NET to actually run this package of course since I'm a .NET developer I have it on my system because it's on my path variable and let me just change my path variable to convince you it's no longer on my path variable and this folder because Jeff created it the permissions are not 100% okay because Windows doesn't know the execute permission so I need to make one change which is add the execute permission to the web application binary and now it is just running so the application developed and published standalone can just run on your fedora machine without there being any requirement for .NET being available there which is quite nice so let me open up this link to show you working quite well here so this is a very nice feature and as I said during my presentation .NET Core 2 will bring a Linux X64 RID so where Jeff just showed us using Fedora 24 at that place we will be able to use Linux X64 and that will enable the standalone application to run on all major Linux distros so Jeff was using Visual Studio on Windows I will show you Visual Studio Code here running on my let me open up a new terminal just to get my regular part in there I will show you Visual Studio Code Visual Studio Code is a free open source IDE it supports quite a number of programming languages including C-Sharp you enable that by installing the C-Sharp extension just like in Visual Studio Visual Studio Code has IntelliSense so this is also powered by OmniSharp and OmniSharp is also open source and it uses Roslin which is the .NET compiler platform under the hood so if I use the app variable here which is an I application builder it shows me all the methods which are applicable for that type if I pick one of the methods I can see the different overloads which are available so IntelliSense powered actually by the same tooling which is powering also Visual Studio on Windows I can also go and debug that app I put a break point here so I can launch a debugger here from Visual Studio Code and you will see everything you'd expect a debugger to have available so once we hit that break point I'll see a list of variables show up here I can zoom into that look at what is here for example the amp contact route path for this demo etc here you can see the call stack and you can just have a very nice debugging experience here also while developing using Visual Studio Code on your Linux machine the last thing I want to show you is also a cross-platform feature let's say is publishing this application into OpenShift so OpenShift is a container platform and Red Hat is contributing a lot into OpenShift and as I said during my talk we have a source to image builder and the source to image builder is capable of taking build NAT code and just build it and deploy it and that's what we'll do here so my code here is on github and I can just use the OC which is the OpenShift client tools and I create a new project here for OpenShift so my project shows up nicely here in the coobie and next thing I'm going to do is an OC new app I specify my runtime which is .NET 1.1 now I give it a URL to my source code repository I tell it where my startup project lives inside this repository and I need to set one and far and this is actually mapping the code that we'll be using to the port exposed by the container running in OpenShift so after I issue this command you see that a build has started in OpenShift I can just click here we're waiting for the build to start and this build log in a couple of seconds you can also just touch that on the console using the command that OpenShift client tools just gave us there so now it's pulling this builder image and then it's pulling in my source code from GitHub and the first thing it will do is what you also saw in Visual Studio is it will restore dependencies specified in the project JSON file so there it goes it will fetch the dependencies this is the builder image which comes already with OpenShift and we're making some improvements to that as we learn ourselves how .NET Core applications are built typically so for example the ASPNET Core which I had to set there in the next version of the builder image that will be included so you no longer have to specify that variable Jeff also showed some tools like Bower and Gulp you will be able to enable those so if you want to use those for your front-end website you will be able to say I'm using the Gulp task runner please make sure it's available when I build it so like that OpenShift will also be able to use your front-end using the JavaScript tools you like most so it restored the dependencies and then it started building our app and as a last step it will take the app and it will publish it as a container into OpenShift and this will be our runtime container so this will be the container which is launching the .NET application so at the end of the log it will push like four layers of a Docker image and then it will take that image and deploy it I'm actually using an OpenShift staging server so sometimes I see some error message which is not on the production server but I ignore it so if I understand well it doesn't run in Bower and Gulp at the moment because this is a plain C sharp and I ran actually for this project in advance the Bower and Gulp tools because it is not yet available in the source to image builder which is now in OpenShift but when we upgrade the builder you will be able to specify while it's pushing these images I can show you this repo the source code for the image builder is also online on github and if we have a look in the readme you will be able to specify with an end for far for the build deployment the tools you want so if you would set this variable to Gulp Bower it will do an npm install and you will be able to use those for example as part of your publish step let's see where we are so it's pushing the layers still it's a good time to drink a cup of coffee one thing we also want to do is make the runtime image a bit smaller and this would also make this step a bit faster Windows we saw you run the application in isexpress what is the web server running here so I think in Windows probably it was using isexpress as the front-end web server and then castrol after it so castrol is the open source .NET core HTTP web server and it is using castrol here as well and it's a very high performance web server it's capable of handling millions of requests per second and Jeff mentioned in his talk also the tech and power benchmark how it is performing against some other well-known web frameworks and web servers so we are using to run the .NET core application exactly the same web server as Jeff was using in his demo actually comparing performance here there is an ASP-NET benchmark possibly I think but as far as I when I last looked at it it had been updated for a while and it was very serious here which you need to take into account so if you look at the tech and power benchmark it is using castrol and nothing is in front of it for example Jeff was using their castrol with IS in front of it performance will of course be a lot lower there if you put NGINX in front of it it's a very fast web server but if you put something in front of it which you will most likely do in a production scenario performance will be less and it depends if you are running it in a container then of course something will be in front of it again so it depends on your deployment where castrol is running and who is handling the requests why is the running the same web server so the interest in having a high performance web server is really there the same Microsoft wants to make this a great web server on the NGINX as well do you want to add something Jeff so the question was the question was what's the interest in Microsoft in making a high performance web server that works the same on both Linux and Windows and we want to maintain one source code base we want to make sure everybody gets the same features at the same time and that we don't rely on something that's deep embedded in Windows that not all the other operating systems have so that helps us also make sure that it will work great when we deploy to the cloud Azure or OpenShift or the bookstore at Amazon we want to make sure it works great on everybody's cloud so the castrol web server is really designed to be rebuilt from the ground up and very highly compatible we're seeing numbers in our most recent tests that looks like castrol is about 5% faster on Windows than on Linux it's still millions of requests per second so you're in pretty good shape when you put that behind in a patchy or in-genet server you're going to see performance drop off a little bit but it's a trade-off for more security and better protection so I think the ASPnet benchmark repository is really the place where you need to look to see what the numbers are and also the different front ends who are taking your requests and handing them over to castrol there so probably there will be an update in the near future of those benchmarks so in the meanwhile our runtime image was pushed into OpenShift and here it is running for web application so this service is now running internally in OpenShift could for example be an internal web API project we want to expose it so I'm going to run the expose command here now the website we just built in OpenShift and deployed is available to everyone on the public internet and there it is quite nice only handing it to URL and building and deploying in OpenShift so that was it for the demo we already had some interesting questions are there other questions no thank you for attending the talk and for helping me with the demo that's it thanks thank you you're welcome I have an incredible presentation back here yes you can go after I was just saying is that method that you have to go get the models and the other parts of the we call the wrapping wrap those things will be forced out and there's a scheme of an empty state Oh, good. Oh, that's great. All right. Okay. Okay. Okay. Okay. Okay.