Microsoft has released .NET 7 preview 1 last week Feb 17th, 2022. In this write-up, we will learn what’s new in .NET 7 preview and create a sample project in .NET 7. As per Microsoft, it is built on the foundation of .NET 6 that includes a unified set of base libraries, runtime, and SDK, an effortless development experience, and high-pitched developer productivity. Mainly, .NET 7 has brought enhanced support for cloud-native scenarios, tools to make it easier to upgrade legacy projects, and simplifying the developer experience by making it easier to work with containers. To know more details about .NET 7 Preview 1 and its features, you can check the official announcement.
- .NET 7 Preview
- Visual Studio 2022 17.2 Preview1
If you have already installed the visual studio 2022 17.1.0 version then, installing the above two prerequisites will be enough for you. You can directly configure from Visual Studio 2022 17.1.0 to Visual Studio 2022 17.2 Preview1 by changing the update setting.
Now, Let’s create a console application in .NET 7.
Open Visual Studio 2022 and click Create a new project.
Select Console App as shown below and click Next.
Give project name, location and click on Next.
Then, select Framework: .NET 7.0(Preview) as illustrated below and click Create.
Then it will create a project which looks like it as depicted below. You can see, there are no differences in Program.cs file of .NET 6 and .NET 7. you can refer to the previous article on Getting Started with .NET6.
Project.csproj file looks like below.
If you go to the bin folder–>debug, then you will see .net7.0 folder. Inside this folder files including dll, exe, and all relevant to your project will be available there.
You can run the .exe and launch your application.
Hence, we have created a console application in .NET 7.0.
In this article, we created the console application in .NET 7. Microsoft has released .NET 7 preview 1 recently which is based on the foundation set up by .NET 6. It is available in Visual Studio 2022 version 17.2 Preview 1 with improvement in Web Tools, Git Tooling, Productivity, Razor (ASP.NET Core) Editor, debugging and Diagnostics, and so on.
More details on new improvements and features to this release (VS2022 17.2 Preview 1) can be found from the Microsoft Release note here.