{"id":2770,"date":"2016-06-30T16:04:34","date_gmt":"2016-06-30T14:04:34","guid":{"rendered":"https:\/\/sii.pl\/blog\/?p=2770"},"modified":"2023-08-18T17:05:19","modified_gmt":"2023-08-18T15:05:19","slug":"microsofts-revolution-asp-net-core-1-0","status":"publish","type":"post","link":"https:\/\/sii.pl\/blog\/en\/microsofts-revolution-asp-net-core-1-0\/","title":{"rendered":"Microsoft\u2019s revolution \u2013 ASP.NET Core 1.0"},"content":{"rendered":"\n<p>Dear .NET developers \u2013 big changes finally came! Open source and cross-platform .NET? Yes! Let me introduce <strong>ASP.NET Core.<\/strong><\/p>\n\n\n\n<p>Don\u2019t get confused! The naming of ASP.NET versions is changing \u2013 the new version is still called ASP.NET 5 but as soon as all of the parts will be ready to distribute the name will be officially changed to APS.NET Core 1.0. What about the versions of MVC and Web API? Those will no longer be problem \u2013 MVC and Web API are now included in ASP.NET Core and they all share one version as parts of one single framework. For purpose of this article I will use the final naming \u2013 ASP.NET Core 1.0.<br>ASP.NET Core can run on both .NET Framework and .NET Core.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">.NET CORE 1.0<\/h2>\n\n\n\n<p>.NET Core is not another version of .NET Framework, it is not improving the previous version and doesn\u2019t replace it. This is totally new approach \u2013 .NET Core 1.0 is a small, modular runtime that includes some parts of the .NET Framework. It is optimized for server and cloud workloads. It is a new line of .NET and it will be developed and supported as well as the .NET Framework line.<br>And the most surprising thing is that \u2013 unlike any other version of .NET Framework \u2013 .NET Core is <b>open source<\/b> (both runtime and framework libraries) and <b>cross-platform<\/b> (supported on Windows, Linux and Mac). And that makes it the Microsoft\u2019s revolution!<br>.NET Core contains CoreFX \u2013 set of libraries and CoreCLR \u2013 which is Common Language Runtime. Both parts are distributed via Nuget.<br><strong>CoreFX<\/strong> \u2013 each of the library in the set is designed in order to requiring as little dependencies as possible which allows to include into your application only those of CoreFX that you actually need.<br><strong>CoreCLR<\/strong> \u2013 the main advantage of .NET Core is its portability assured by CoreCLR \u2013 it can be packaged and deployed with your application. It doesn\u2019t require any version of .NET installed. Furthermore multiple application can be hosted side-by-side using different versions of CoreCLR and they can be upgraded individually.<br>.NET Core supports set of languages, especially C#, VB and F#, as well as language features \u2013 like generics, LINQ, async support and many more.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ASP.NET CORE 1.0<\/h2>\n\n\n\n<p>ASP.NET Core is a framework for building modern Web applications. It was created in particular for cloud-based apps. It consists of modular components which results of making web apps that are not excessive \u2013 as we must include only those parts that we actually use. That keeps the flexibility of the app.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2016\/05\/asp1.png\"><img decoding=\"async\" width=\"300\" height=\"144\" src=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2016\/05\/asp1-300x144.png\" alt=\"asp\" class=\"wp-image-2773\" srcset=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2016\/05\/asp1-300x144.png 300w, https:\/\/sii.pl\/blog\/wp-content\/uploads\/2016\/05\/asp1.png 581w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Your first ASP.NET Core application \u2013 it\u2019s very easy to start! And you can use Community edition of Visual Studio and ASP.NET Core \u2013 both available for free. Running the application on the localhost using IIS Express didn\u2019t change from previous versions of framework.<br>Significant changes start from file structure of the project. ASP.NET Core works on file system \u2013 it detects any code changes (from and outside VS), compiles into memory and loads the app \u2013 which helps with faster developing. Let\u2019s start with checking the main folder of the app \u2013 there are:<br>\u2022 Solution file (.sln extension typical for VS)<br>\u2022 File global.json which contains configuration<br>\u2022 The src folder containing the source code<br>The configuration files are written in the json notation (JavaScript Object Notation) \u2013 so they are more light than XML files.<br>The <strong>global.json<\/strong> file generated for new project look like that:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n{\n\"projects\": &#x5B; \"src\", \"test\" ],\n\"sdk\": {\n\"version\": \"1.0.0-rc1-update1\"\n}\n}\n<\/pre><\/div>\n\n\n<p>The <strong>projects<\/strong> setting indicates where are located folders containing the source code. From default there are src folder for sources and test for unit tests project. Newly created project has its source files in src folder. Within the listed folders there will be searched projects of the solution.<br>The <strong>sdk<\/strong> setting specifies the version of the DNX (.Net Execution Environment) which is used for opening the solution.<br>Inside the src folder there is exactly the same content as in the solution folder \u2013 and since ASP.NET Core works on file system adding (or deleting) a new file into the folder adds (or delete) this file to the solution as well. There is no need to build the app \u2013 all you have to do is refresh the browser to see the modifications.<br>One of the breaking changes about the configuration files was replacing .csproj file by .xproj and project.json files. Both files concerns only a project and not the solution. However this idea was improved in version RC2 eventually it has been decided to return to original .NET configuration \u2013.csproj file for newer versions. But as the RC2 version is the latest (during writing this article) the project.json still oblige let\u2019s take a look at some of its parts:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n{\n(\u2026)\n \n\"dependencies\": {\n\"Microsoft.NETCore.App\": {\n\"type\": \"platform\",\n\"version\": \"1.0.0-rc2-*\"\n},\n \n\"tools\": {\n\"Microsoft.AspNetCore.Server.IISIntegration.Tools\": \"1.0.0-preview2-final\",\n\"Microsoft.EntityFrameworkCore.Tools\": \"1.0.0-preview2-final\",\n\"Microsoft.AspNetCore.Razor.Tools\": \"1.0.0-preview2-final\",\n\"Microsoft.Extensions.Caching.SqlConfig.Tools\": \"1.0.0-preview2-final\",\n(\u2026)\n},\n \n\"frameworks\": {\n\"dnx451\": { },\n\"dnxcore50\": { }\n},\n(\u2026)\n}\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>The dependencies setting contains listed all top level NuGet packages that are used in the project. Good to know that there are IntelliSense help in this part for the package and its version as well \ud83d\ude42<\/li>\n\n\n\n<li>The tools setting specifies packages containing tools.<\/li>\n\n\n\n<li>The frameworks setting indicates which framework can be used by the project. By default two are added \u2013 full .NET Framework and Core CLR.<\/li>\n<\/ul>\n\n\n\n<p>Changes of .NET Core are still happening \u2013 in version RC1 the files global.asax and Web.config were replaced by single file Startup.cs. All the configuration required on starting the app is inside this file in Startup class. But since version RC2 web.config returns. So when you start to working on .NET Core remember to always keep track of current version.<br>At the end of this article I would like to encourage all of you to try .NET Core to see what can you achieve with it. Enjoy! \ud83d\ude42<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;2770&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;1&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;11&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;5\\\/5 ( vote: 1)&quot;,&quot;size&quot;:&quot;18&quot;,&quot;title&quot;:&quot;Microsoft\u2019s revolution \u2013 ASP.NET Core 1.0&quot;,&quot;width&quot;:&quot;139.5&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} ( {votes}: {count})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 139.5px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 14.4px;\">\n            5\/5 ( vote: 1)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Dear .NET developers \u2013 big changes finally came! Open source and cross-platform .NET? Yes! Let me introduce ASP.NET Core. Don\u2019t &hellip; <a class=\"continued-btn\" href=\"https:\/\/sii.pl\/blog\/en\/microsofts-revolution-asp-net-core-1-0\/\">Continued<\/a><\/p>\n","protected":false},"author":80,"featured_media":2789,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","inline_featured_image":false,"footnotes":""},"categories":[1320],"tags":[1477,1364,1478,1365,1479,1457,1480,1481],"class_list":["post-2770","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hard-development","tag-net-en","tag-net-core-en","tag-asp-net-en","tag-asp-net-core-en","tag-coreclr-en","tag-cross-platform-en","tag-nuget-en","tag-open-source-en"],"acf":[],"aioseo_notices":[],"republish_history":[],"featured_media_url":"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2016\/06\/as.net_core_1-sii-blogersii-1140x540.jpg","category_names":["Hard development"],"_links":{"self":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts\/2770"}],"collection":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/users\/80"}],"replies":[{"embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/comments?post=2770"}],"version-history":[{"count":2,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts\/2770\/revisions"}],"predecessor-version":[{"id":23633,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts\/2770\/revisions\/23633"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/media\/2789"}],"wp:attachment":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/media?parent=2770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/categories?post=2770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/tags?post=2770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}