Skip to main content

Creating First ASP.NET Core 3.0 App with Visual Studio 2019 Preview

The first public preview of Visual Studio 2019 and .NET Core 3.0 is out. I expect both to be a major release with lots of new features and some code breaking changes. The biggest change with .NET Core 3.0 is support for desktop applications and ASP.NET Core 3.0 will only run on .NET Core. In this post, we’ll see how to install .NET Core 3.0 and Visual Studio 2019 preview, new features of visual studio 2019 and also creating first ASP.NET Core 3.0 app with Visual Studio 2019.

Creating First ASP.NET Core 3.0 App with Visual Studio 2019

Before we create the application, first we need to install Visual Studio 2019 and .NET Core 3.0. Let’s first install .NET Core 3.0 SDK.

Installing .NET Core 3.0

To download .NET Core 3.0, visit this link. Based on your platform, download the appropriate installer. Once the download is complete, run the installer to install .NET Core 3.0 on your system. The .NET Core 3.0 preview installation will not impact your existing .NET Core version installation.

Installing Visual Studio 2019 Preview

To install Visual Studio 2019 preview, download the installer from this location. Don’t worry. Visual Studio and Visual Studio “Preview” can be installed side-by-side on the same device. It will have no impact on your current stable VS installation.

Installing Visual Studio 2019 Preview 1

Once the installer is downloaded, run the installer. The installer will download the required files and install them.

Installing Visual Studio 2019 Preview

After completing the download and installation, then workloads will open. Select what are the workloads we need. To start, select ASP.NET and web development, .NET Core cross-platform development.

Installing Visual Studio 2019 Preview

The installation will take some time to complete. After completing the installation successfully, click the “Launch” button to launch the Visual Studio 2019.

Creating First ASP.NET Core 3.0 App with Visual Studio 2019 Preview

Before we create the app, there are a couple of new worth looking changes in Visual Studio 2019. The very first visible change is the app icon.

Visual Studio 2019 new icon

Next change is the new splash screen.

Visual Studio 2019 Startup Screen

The startup window is completely revamped and even in the preview stage, it opens much faster compare to Visual Studio 2017. The new startup window of VS 2019 looks like,

Visual Studio 2019 Startup window

This new experience is designed to work with today’s Git repositories – whether local repos or online Git repos on GitHub, Azure Repos, or elsewhere. You can also open an existing project or solution or create a new one. The window also shows the recent item list. This recent project list is fetched from Visual Studio 2017 as this is the first time I opened Visual Studio 2019. The Continue without Code option will open an instance of Visual Studio 2019.

When you click on “Create a new Project” option, you will see the following screen.

Creating first ASP.NET Core 3.0 App with Visual Studio 2019

As you can see, the installed project templates are listed based on the popularity. There are 3 drop downs at the top of the page to choose language, platform, and project type. This is a nice feature as it helps to locate the correct project template. Let’s create an ASP.NET Core 3.0 application. To do that, select the ASP.NET Core Web application template and hit “Next”.

Creating first ASP.NET Core 3.0 App with Visual Studio 2019

In the next screen, enter the project name, select the location and hit “Create” button to create the project.

Creating first ASP.NET Core 3.0 App with Visual Studio 2019

You will be prompted with this familiar following dialog box, where you need to choose the project template. You may see a warning in the dialog box saying “ASP.NET Core 3.0 or newer projects are not supported by this version of Visual Studio.

ASP.NET Core 3.0 project not supported error

At the time of writing this post, this is a known issue and the workaround is to hit the ‘Cancel’ in dialog and then restart VS for the yellow-bar message to go away and ASP.NET Core 3.0 to show up in the dropdown. Simply cancel and re-open dialog without restarting VS does not fix the issue. So restart the VS and create the ASP.NET Core web application again.

Now, you should see ASP.NET Core 3.0 listed in the version selection dropdown. Select ASP.NET Core 3.0 from the dropdown and click “Ok” to create the application.

Creating first ASP.NET Core 3.0 App with Visual Studio 2019

After a few seconds, the ASP.NET Core 3.0 based web application will be created. At this point of time, there are no major differences you will find in this app, if you compare with ASP.NET Core 2.2.

ASP.NET Core 3.0 is expected to be a major version and will have some code breaking changes. The already known changes are:

  • ASP.NET Core shared framework (Microsoft.AspNetCore.App) will only contain first-party assemblies that are fully developed, supported, and serviceable by Microsoft. As part of this change, the following sub-components will be removed from shared framework.
    • Json.NET (Newtonsoft.Json)
    • Entity Framework Core (Microsoft.EntityFrameworkCore.*)
    • Microsoft.CodeAnalysis (Roslyn)

    Json.NET or Entity Framework Core will continue to work with ASP.NET Core, but they will not be “in the box” with the shared framework.

  • ASP.NET Core 3.0 will come with high performance in-box JSON APIs to remove the tight coupling of ASP.NET Core and JSON.NET.

But at this point of time, these changes are not implemented in this preview release as Newtonsoft.json is still present in Microsoft.AspNetCore.App. Though there is one difference that I noticed. The following tag is not present in the .csproj file as this is expected to go.

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> 

Microsoft also changed the default template compare to the ASP.NET Core 2.2 template, but I believe this would change as this is a preview release. There are no problems for building and running the app.

There is one more nice feature with Visual Studio 2019, which is document health and code cleanup. The visual studio 2019 shows a document health indicator (next to scroll bar) and there is a new code cleanup command. You can use this new command to identify and then fix both warnings and suggestions with the click of a button.

Visual Studio 2019 Code Clean up

There are some other small changes as well.

  • Refreshed Blue theme
  • No Title bar
  • A New search experience, which replaces the existing “Quick Launch” box. You can now search for settings, commands, and install options. The new search experience is also smarter, as it supports fuzzy string searching to help find what you are looking for even when misspelled.

Visual Studio Theme Difference

That’s it for now.

Summary

Visual Studio 2019 is already looking very impressive, fast and offering great features. For ASP.NET Core 3.0, this is the first preview release so not all the features are present in this release. I am expecting the preview 2 release will have a lot more new features to play with.

Thank you for reading. Keep visiting this blog and share this in your network. Please put your thoughts and feedback in the comments section.

PS: If you found this content valuable and want to return the favour, then Buy Me A Coffee

4 thoughts to “Creating First ASP.NET Core 3.0 App with Visual Studio 2019 Preview”

Leave a Reply

Your email address will not be published. Required fields are marked *