Visual Studio 2022 and .Net 6
Visual Studio 2022, .Net 6, and C# 10 - Released This Week
Two products core to software development in the Microsoft stack received major updates this week. Visual Studio is now at version 2022 (up from 2019) and the .Net Framework is now at version 6 (up from 5).
Visual Studio 2022
The Visual Studio 2022 integrated development environment (IDE) is the primary tool for most profession developers working in the Microsoft stack (although VS Code is excellent too!)
Visual Studio just keeps getting better and faster. Many of the updates in the release focus on improved usability, including:
- 64-bit code base, allowing VS to support larger and more complex projects
- Hot Reload
- running code can be automatically updated when the code file is saved. This is a continuation of the existing Edit-and-Continue features. Microsoft has tried to implement this in various ways over the years with functionality such as "AddRazorRuntimeCompilation" in ASP.Net projects with mixed success. I've tested hot reload in a .Net 6 web app and it works well. Updates to razor or css promptly update the running, displayed web page (razor requires a file save, css does not). This is certainly a nice feature when trying to tune the display of a web page.
- according to the documentation this should also work in other project types, such as console applications, but it doesn't work for me. It works if I run the app from the command line with "dotnet watch run", but not using the VS IDE.
- Intellicode - VS will work hard to make coding suggestions, including prompting to complete the entire line of code
More details about the new features in VS 2022 and a download link can be found here.
.Net 6 (and C# 10)
.Net 6 continues the convergence of the legacy, full .Net Framework and the newer .Net Core which first began with .Net 5.
.Net 6 is an excellent, high-performance, cross-platform framework option for software development. ASP.Net is currently ranked a close second on the TechEmpower plaintext benchmark.
Here are some updates that can have an immediate and positive on development:
- top level statements - the entry point for a program can now just contain code and omit code like "public static void main..."
- file scoped namespaces - the namespace statement can just be added at the top of the code file like "namespace X.Y.Z;" with no braces, saving one level of indentation
- global usings and implicit usings
- using statements can be declared globally in any .cs file using the syntax like "global using System;"
- if enabled in the project file, certain namespaces can be added as global implicit directives based on project type (targeted SDK). For example "System.IO" can be added implicitly when creating a console application.
- improved file system performance and JSON performance
More details about the new features in .Net 6 and C# 10 can be found here.
I'm excited about Microsoft's direction and continued progress with Visual Studio and .Net. I have upgraded this website (karush.com) from .Net 3.1 to .Net 6 using VS 2022. Probably the most complicated step was managing the few changes needed to accommodate the Bootstrap update from 4.x to 5.x. The top-level statements were a nice simplification and hot reload make the layout updates pretty simple. I didn't encounter any issues related to .Net 6.