ASP.NET Core updates in .NET Core 3.1 Preview 1

Daniel Roth


.NET Core 3.1 Preview 1 is now available. This release is primarily focused on bug fixes, but it contains a few new features as well.

Here’s what’s new in this release for ASP.NET Core:

  • Partial class support for Razor components
  • Pass parameters to top-level components
  • Support for shared queues in HttpSysServer
  • Breaking changes for SameSite cookies

Alongside this .NET Core 3.1 Preview 1 release, we’ve also released a Blazor WebAssembly update, which now requires .NET Core 3.1. To use Blazor WebAssembly you will need to install .NET Core 3.1 Preview 1 as well as the latest preview of Visual Studio.

See the release notes for additional details and known issues.

Get started

To get started with ASP.NET Core in .NET Core 3.1 Preview 1 install the .NET Core 3.1 Preview 1 SDK.

If you’re on Windows using Visual Studio, for the best experience we recommend installing the latest preview of Visual Studio 2019 16.4. Installing Visual Studio 2019 16.4 will also install .NET Core 3.1 Preview 1, so you don’t need to separately install it. For Blazor development with .NET Core 3.1, Visual Studio 2019 16.4 is required.

To install the latest Blazor WebAssembly template run the following command:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.1.0-preview1.19508.20

Upgrade an existing project

To upgrade an existing ASP.NET Core 3.0 project to 3.1 Preview 1:

  • Update any projects targeting netcoreapp3.0 to target netcoreapp3.1
  • Update all Microsoft.AspNetCore.* package references to 3.1.0-preview1.19506.1

See also the full list of breaking changes in ASP.NET Core 3.1.

That’s it! You should now be all set to use .NET Core 3.1 Preview 1!

Partial class support for Razor components

Razor components are now generated as partial classes. You can author the code for a Razor component using a code-behind file defined as a partial class instead of defining all the code for the component in a single file.

For example, instead of defining the default Counter component with an @code block, like this:


@page "/counter"


<p>Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
    int currentCount = 0;

    void IncrementCount()

You can now separate out the code into a code-behind file using a partial class like this:


@page "/counter"


<p>Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>


namespace BlazorApp1.Pages
    public partial class Counter
        int currentCount = 0;

        void IncrementCount()

Pass parameters to top-level components

Blazor Server apps can now pass parameters to top-level components during the initial render. Previously you could only pass parameters to a top-level component with RenderMode.Static. With this release, both RenderMode.Server and RenderModel.ServerPrerendered are now supported. Any specified parameter values are serialized as JSON and included in the initial response.

For example, you could prerender a Counter component with a specific current count like this:

@(await Html.RenderComponentAsync<Counter>(RenderMode.ServerPrerendered, new { CurrentCount = 123 }))

Support for shared queues in HttpSysServer

In addition to the existing behavior where HttpSysServer created anonymous request queues, we’ve added to ability to create or attach to an existing named HTTP.sys request queue. This should enable scenarios where the HTTP.Sys controller process that owns the queue is independent to the listener process making it possible to preserve existing connections and enqueued requests between across listener process restarts.

public static IHostBuilder CreateHostBuilder(string[] args) =>
        .ConfigureWebHostDefaults(webBuilder =>
            // ...
            webBuilder.UseHttpSys(options =>
                options.RequestQueueName = "MyExistingQueue",
                options.RequestQueueMode = RequestQueueMode.CreateOrAttach

Breaking changes for SameSite cookies

This release updates the behavior of SameSite cookies in ASP.NET Core to conform to the latest standards being enforced by browsers. For details on these changes and their impact on existing apps see

Give feedback

We hope you enjoy the new features in this preview release of ASP.NET Core! Please let us know what you think by filing issues on GitHub.

Thanks for trying out ASP.NET Core!


Comments are closed. Login to edit/delete your existing comments

  • Avatar
    Jing Zhe Shan

    Hey Daniel, this is very exciting, and I tried using blazor web assembly build few components, seems very promising 👏🎉 I just wondering can we start using this to build up sth, are there any significant breaking changes going to happen in next few months? Thanks.

    • Daniel Roth
      Daniel RothMicrosoft employee

      Hi Jing,

      Blazor WebAssembly is still in preview, so some changes are expected. The good news is that Blazor WebAssembly uses exactly the same component model as Blazor Server, so we don’t expect breaking changes with how you author components. However, there will likely be changes in how Blazor WebAssembly apps are hosted, like what happens on build & publish, how static files are handled, what the WebAssembly host looks like, etc.

      I hope this helps!

  • Daniel Pach
    Daniel Pach


    Since Blazor is such a new technology, it is sometimes challenging to figure out how to handle more complex UI scenarios. The official documentation covers basic concepts, but I’d like to see a few examples of best practices for designing large enterprise applications – e.g. proper way to handle communication between sibling/distant components, implementing multi-tabbed UI, how to implement state management for an application with hundreds of components etc. Keep in mind that there is probably substantial user base that plans to use Blazor for desktop applications (converting legacy WebForms/WPF applications).

    Are you planning on releasing more real-world examples besides the few demos (Flight Finder and Blazing Pizza) that are currently available?

    I think it would be very beneficial if Microsoft designed some of its own products using this technology to give developers confidence that Blazor is ready for prime time and that all realistic scenarios can be elegantly implemented.


    • Rod Macdonald
      Rod Macdonald

      I hope MS releases something like the old IBuySpy app that was available for ASP.NET when it came out – that was a pretty useful and substantial reference app. I’m not sure if something similar was released at .NETConf this year. There was mention of an e-commerce demo on day 3, I think, but I missed those presentations and couldn’t find a catch up anywhere. Ditto Ed Charbeneau’s talk but Ed kindly sent me a link to his presentation.

  • Avatar
    taurius litvinavicius

    Are there any plans to improve file handling? Have some native file picker/file stream? To me this seems to be the biggest issue, to really exploit the technology to the fullest extent.