{"id":24511,"date":"2018-05-07T18:00:55","date_gmt":"2018-05-07T18:00:55","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/?p=13625"},"modified":"2018-05-07T18:00:55","modified_gmt":"2018-05-07T18:00:55","slug":"asp-net-core-2-1-0-rc1-now-available","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2018\/05\/07\/asp-net-core-2-1-0-rc1-now-available\/","title":{"rendered":"ASP.NET Core 2.1.0-rc1 now available"},"content":{"rendered":"<p>Today we\u2019re happy to announce the first release candidate of ASP.NET Core 2.1! This release should be very close to the final stable release of ASP.NET Core 2.1 and includes primarily bug fixes and polish for the <a href=\"https:\/\/blogs.msdn.microsoft.com\/webdev\/2018\/04\/12\/asp-net-core-2-1-0-preview2-now-available\/\">features that we shipped in earlier previews<\/a>. This is a &#8220;go live&#8221; release that can be used in production with the understanding that you will need to update to the final stable release once it is available. <\/p>\n<p>Also, be sure to read about <a href=\"https:\/\/blogs.msdn.microsoft.com\/dotnet\/2018\/05\/07\/announcing-net-core-2-1-rc-1\/\">.NET Core 2.1.0-rc1<\/a> and <a href=\"https:\/\/blogs.msdn.microsoft.com\/dotnet\/2018\/05\/07\/announcing-entity-framework-core-2-1-rc-1\">Entity Framework Core 2.1.0-rc1<\/a>.<\/p>\n<h3 id=\"get-started\">Get started<\/h3>\n<p>To get started with ASP.NET Core 2.1.0-rc1 download the <a href=\"https:\/\/www.microsoft.com\/net\/download\/dotnet-core\/sdk-2.1.300-rc1\">.NET Core 2.1.0-rc1 SDK<\/a><\/p>\n<p>Customers using Visual Studio should also install <a href=\"https:\/\/visualstudio.com\/vs\">Visual Studio 2017 Update 7<\/a> or <a href=\"https:\/\/www.visualstudio.com\/vs\/mac\/\">Visual Studio for Mac 7.5<\/a>.<\/p>\n<h3 id=\"migrating-an-asp-net-core-2-0-x-project-to-2-1-0-rc1\">Migrating an ASP.NET Core 2.0.x project to 2.1.0-rc1<\/h3>\n<p>To migrate an existing ASP.NET Core 2.0.x project to 2.1.0-rc1:<\/p>\n<ol>\n<li>Open the project\u2019s .csproj file and change the value of the <code>&lt;TargetFramework&gt;<\/code> element to netcoreapp2.1\n<ul>\n<li>Projects targeting .NET Framework rather than .NET Core, e.g. net471, don\u2019t need to do this<\/li>\n<\/ul>\n<\/li>\n<li>In the same file, update the versions of the various <code>&lt;PackageReference&gt;<\/code> elements for any Microsoft.AspNetCore, Microsoft.Extensions, and Microsoft.EntityFrameworkCore packages to 2.1.0-rc1-final<\/li>\n<li>In the same file, remove any references to <code>&lt;DotNetCliToolReference&gt;<\/code> elements for any Microsoft.AspNetCore, Microsoft.VisualStudio, and Microsoft.EntityFrameworkCore packages. These tools are now deprecated and are replaced by global tools.<\/li>\n<\/ol>\n<p>That should be enough to get the project building and running against 2.1.0-preview2. The following steps will change your project to use new code-based idioms that are recommended in 2.1<\/p>\n<ol>\n<li>Open the Program.cs file<\/li>\n<li>Rename the <code>BuildWebHost<\/code> method to <code>CreateWebHostBuilder<\/code>, change its return type to <code>IWebHostBuilder<\/code>, and remove the call to <code>.Build()<\/code> in its body<\/li>\n<li>Update the call in Main to call the renamed <code>CreateWebHostBuilder<\/code> method like so: <code>CreateWebHostBuilder(args).Build().Run();<\/code><\/li>\n<li>Open the <em>Startup.cs<\/em> file<\/li>\n<li>In the <code>ConfigureServices<\/code> method, change the call to add MVC services to set the compatibility version to 2.1 like so: <code>services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);<\/code><\/li>\n<li>In the Configure method, add a call to add the HSTS middleware after the exception handler middleware: <code>app.UseHsts();<\/code><\/li>\n<li>Staying in the <code>Configure<\/code> method, add a call to add the HTTPS redirection middleware before the static files middleware: <code>app.UseHttpsRedirection();<\/code><\/li>\n<li>Open the project property pages (right-mouse click on project in Visual Studio Solution Explorer and select \u201cProperties\u201d)<\/li>\n<li>Open the \u201cDebug\u201d tab and in the IIS Express profile, check the \u201cEnable SSL\u201d checkbox and save the changes<\/li>\n<li>In you project file change any package reference to Microsoft.AspNetCore.All package to Microsoft.AspNetCore.App and add additional packages as needed to restore the your required dependency graph<\/li>\n<\/ol>\n<p>Note that some projects might require more steps depending on the options selected when the project was created and modifications made to the project.<\/p>\n<h3 id=\"deploying-to-azure\">Deploying to Azure<\/h3>\n<p>Azure App Service will start deploying .NET Core 2.1.0-rc1 with the next week or so. In the meantime you can still deploy apps using ASP.NET Core 2.1.0-rc1 by deploying as stand-alone applications.<\/p>\n<h3 id=\"new-features-and-enhancements\">New features and enhancements<\/h3>\n<p>This release primarily contains refinements and bug fixes to the features we shipped in earlier previews, but there are a couple of new features and enhancements worth calling out. You can find a complete list of the features and enhancements in this release in the <a href=\"https:\/\/github.com\/aspnet\/Home\/releases\/tag\/2.1.0-rc1\">release notes<\/a>.<\/p>\n<h4 id=\"new-razor-ui-class-library-template\">New Razor UI Class Library template<\/h4>\n<p>The new Razor Class Library project template makes it easy to build reusable Razor UI class libraries. Razor class library projects are already setup with the Razor SDK to enable building Razor files (.cshtml) like MVC views and Razor Pages.<\/p>\n<p>To create a new Razor class library project from the command-line:<\/p>\n<pre><code>dotnet <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-type\">razorclasslib<\/span> -o RazorClassLib1&#013;\n<\/code><\/pre>\n<p>You can also create Razor class library projects in Visual Studio from the &#8220;New ASP.NET Core Web Application&#8221; dialog.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2018\/06\/asp-net-core-2-1-0-rc1-now-available.png\" alt=\"Razor class library project template\" \/><\/p>\n<h4 id=\"improvements-to-mvc-test-infrastructure\">Improvements to MVC test infrastructure<\/h4>\n<p>You can now derive from <code>WebApplicationFactory<\/code> to create a custom factory that configures the <code>HttpClient<\/code> by overriding <code>ConfigureClient<\/code>. This enables testing scenarios that requrie specific <code>HttpClient<\/code> configuration, like adding specific HTTP headers.<\/p>\n<p>We also update the default environment setup by the <code>WebApplicationFactory<\/code> to be development to simplify scenarios like accessing user secrets and other development resources.<\/p>\n<h4 id=\"signalr-updates\">SignalR updates<\/h4>\n<ul>\n<li>The MessagePack protocol library for SignalR was renamed to <strong>Microsoft.AspNetCore.SignalR.Protocols.MessagePack<\/strong><\/li>\n<li>The JavaScript\/TypeScript client Hub connection API changed to use the HubConnectionBuilder (similar to the C# client)<\/li>\n<li>\n<p>Sticky sessions are now required when using the WebSockets transport unless the <code>skipNegotiation<\/code> flag is set to <code>true<\/code>:<\/p>\n<pre><code class=\"lang-js\">var connection = <span class=\"hljs-keyword\">new<\/span> signalR.HubConnectionBuilder()&#013; .withUrl(<span class=\"hljs-string\">\"\/chat\"<\/span>, { <span class=\"hljs-string\">skipNegotiation:<\/span> <span class=\"hljs-literal\">true<\/span>, <span class=\"hljs-string\">transport:<\/span> signalR.HttpTransportType.WebSockets })&#013; .build();&#013;\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3 id=\"summary\">Summary<\/h3>\n<p>Thank you for trying out ASP.NET Core 2.1.0-rc1! Assuming everything goes smoothly with this release we should have a stable release of ASP.NET Core 2.1 shortly. If you have any questions or find any issues with this release please let us know by filing issues on <a href=\"https:\/\/github.com\/aspnet\/home\">GitHub<\/a>. <\/p>\n<p> &#013; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we\u2019re happy to announce the first release candidate of ASP.NET Core 2.1! This release should be very close to the final stable release of ASP.NET Core 2.1 and includes primarily bug fixes and polish for the features that we shipped in earlier previews. This is a &#8220;go live&#8221; release that can be used in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":24512,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[67],"class_list":["post-24511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-webdev","tag-aspnetcore"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/24511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=24511"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/24511\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/24512"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=24511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=24511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=24511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}