Create projects with C#8 – Core 3.0 Preview
Hi guys! Recently, I needed to test some features in C# 8 ! I didn’t want to create a project with another target and then I have to manually modify it.
Why not do I create a project with C# 8 target directly?
We need to configure VS 2019 to enable the possibility to create 3.0 Core Preview Projects.
At this moment, when I want to create a Web Core project, the VS just shows me the following possibilities:
You can see that we only can create an ASP.NET CORE 2.2, 2.1, 2.2 project but I can’t create a 3.0 Core project but I have installed the preview version in my workstation ( https://dotnet.microsoft.com/download/dotnet-core/3.0 – install SDK to build apps ).
Ok, we need to say to VS “Ey, you have 3.0 Core Preview, you should allow me to create this kind of project!“
You need to do the following steps:
- Open VS 2019
- Go to Tools –> Options
- Search “preview” –> Check de option “Use previews of the .NET Core SDK”
- Restart VS
Ok, finally, when I try to create a new project:
Magic! ASP.NET Core 3.0 is here!
Let’s me verify the csproject:
Magic! the newcoreapp3.0 is here! This preview version works with c#8!
We will do a last test, we’ll try to use a new C# 8 Feature: null coalescing assignment ??=.
Perfect! The solution compiles like a champ and we can use the “null coalescing assignment operator ;)”
That’s all! Enjoy it, mates
1 thought on “Create projects with C#8 – Core 3.0 Preview”
Hello. remarkable job. I did not expect this. This is a remarkable story. Thanks!