Microsoft has released .NET 9 Preview 6, introducing significant improvements and new features across the entire .NET ecosystem. This release builds on the foundation of .NET 8, focusing on cloud-native applications, performance enhancements, and developer productivity. In this detailed guide, we will discuss the key highlights of .NET 9 and how to install .NET 9 in Linux.
What's New in .NET 9
The following sections highlight the key updates in this release.
Runtime Improvements
- New attribute model for feature switches with trimming support
- Extensive performance optimizations in areas such as:
- Loop optimizations
- Inlining improvements
- PGO (Profile-Guided Optimization) enhancements
- Arm64 vectorization and code generation
- Faster exception handling
- AVX10v1 support
Library Enhancements
- System.Text.Json: New customization options and web defaults
- LINQ: New
CountBy
andAggregateBy
methods - Collections: Improved
PriorityQueue<TElement,TPriority>
- Cryptography: One-shot hash method and KMAC algorithm support
- Reflection: New
PersistedAssemblyBuilder
for saving emitted assemblies - TimeSpan: Precise
From*
methods for creatingTimeSpan
objects
SDK Improvements
- Enhanced unit testing integration with MSBuild
- New options for
dotnet tool install
- Terminal logger enabled by default with improved usability
- New MSBuild script analyzers
ML.NET and .NET Aspire
- ML.NET 4.0: Support for advanced tokenizers and AI models
- .NET Aspire: Preview release for building cloud-ready, distributed applications
Web Development
ASP.NET Core sees improvements in:
- Blazor
- SignalR
- Minimal APIs
- OpenAPI
- Authentication and authorization
Mobile Development
.NET MAUI focuses on product quality enhancements in this release.
Data Access
Entity Framework Core introduces:
- Significant updates to Azure Cosmos DB provider
- Progress towards AOT compilation and pre-compiled queries
Language Features
C# 13 brings new capabilities:
params
collections- New lock type and semantics
\e
escape sequence- Method group natural type improvements
- Implicit indexer access in object initializers
Desktop Development
Windows Presentation Foundation (WPF) now supports:
- Windows 11 theming
- Hyphen-based ligatures
Install .NET 9.0 SDK in Linux
Step 1: Download .NET 9 Preview 6
Download the latest .NET 9.0 SDK (v9.0.100-preview.6) from the official download page. Click on your preferred Linux binary installer under the "Linux" section. This will download the installer file in your default Downloads folder.
Step 2: Verify the Download
After downloading the installer, verify it to ensure the file hasn't been altered or corrupted.
To verify the checksum:
- Copy the checksum value from the download page.
- Use the
sha512sum
command to print the checksum of the downloaded file.
Example command to print the checksum of value of .NET 9 preview 6 installer file:
sha512sum dotnet-sdk-9.0.100-preview.6.24328.19-linux-x64.tar.gz
Sample Output:
ff040c456b096aeac707053517d5f9f5f0df92b6754a4af6b6fe635fd8f4a569589b8241cbad0c5db998dc5bc54682b2f1e4dc4f3d88024a3ef56c1ecc9f4c97 dotnet-sdk-9.0.100-preview.6.24328.19-linux-x64.tar.gz
Compare the checksum on your computer with the one provided on the download website. If both look same, you're good to go.
Step 3: Extract and Install .NET 9 SDK
After verifying the installer, run the following commands to extract the SDK and set up environment variables (for current session):
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-9.0.100-preview.6.24328.19-linux-x64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
Please note that these commands will only make the .NET SDK commands available for the current terminal session.
Step 4: Permanently Add .NET SDK to PATH
To make the .NET SDK commands available permanently, you need to edit your shell profile. The profile file varies depending on the shell you use:
- Bash Shell:
~/.bash_profile
,~/.bashrc
- Korn Shell:
~/.kshrc
,.profile
- Z Shell:
~/.zshrc
,.zprofile
Edit the appropriate profile file for your shell and add the following lines:
export DOTNET_ROOT=$HOME/dotnet export PATH=$PATH:$HOME/dotnet
Save the file, close your terminal and re-open it.
This will ensure that the .NET SDK commands are available in all terminal sessions.
Step 5: Verify .NET 9 Installation
To check if .NET is installed on your machine, use the following commands:
Check the current .NET SDK version:
dotnet --version
Sample Output:
9.0.100-preview.6.24328.19
List all installed .NET SDKs:
dotnet --list-sdks
Sample Output:
9.0.100-preview.6.24328.19 [/home/ostechnix/dotnet/sdk]
List all installed .NET Runtimes:
dotnet --list-runtimes
Sample Output:
Microsoft.AspNetCore.App 9.0.0-preview.6.24328.4 [/home/ostechnix/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 9.0.0-preview.6.24327.7 [/home/ostechnix/dotnet/shared/Microsoft.NETCore.App]
For someone who has just installed .NET 9.0 Preview 6, these commands would be useful to verify that the new version has been correctly installed and is now the default version on their system.
Step 6: Getting Help with .NET CLI
View general .NET CLI help:
dotnet --help
View help for a specific .NET CLI command:
dotnet [command] --help
By following these steps, you will have .NET 9.0 SDK installed and configured on your Linux machine, ready for development.
Conclusion
The .NET 9 Preview 6 release provides a glimpse into the future of .NET development, offering enhanced performance, improved cloud capabilities, and new tools for building modern applications.
Developers can download it to explore the new features and improvements in this release. As .NET 9 continues to evolve, developers are encouraged to provide feedback and contribute to shaping the future of the platform.
Remember, as this is a preview version, it's best used for testing and development rather than production environments. Keep your system updated and don't hesitate to check the official .NET documentation for the most current information.
For more detailed information on specific features, read the official .NET 9 release announcement in the following link: