https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-1/ Skip to main content [RE1Mu3b] Microsoft .NET Blog .NET Blog .NET Blog * Home * DevBlogs * Developer + Visual Studio + Visual Studio Code + Visual Studio for Mac + DevOps + Developer support + CSE Developer + Engineering@Microsoft + Azure SDK + IoT + Command Line + Perf and Diagnostics + Dr. International + Notification Hubs + Math in Office + React Native * Technology + DirectX + PIX + SurfaceDuo + Startups + Sustainable Engineering + Windows AI Platform * Languages + C++ + C# + F# + Visual Basic + TypeScript + PowerShell Community + PowerShell Team + Python + Q# + JavaScript + Java + Java Blog in Chinese * .NET + .NET + .NET MAUI + Blazor + ASP.NET + NuGet + Xamarin + .NET Blog in Chinese * Platform Development + #ifdef Windows + Apps for Windows + Azure Depth Platform + Azure Government + Azure VM Runtime Team + Bing Dev Center + Microsoft Edge Dev + Microsoft Azure + Microsoft 365 Developer + Old New Thing + Windows MIDI and Music dev + Windows Search Platform * Data Development + Azure Cosmos DB + Azure Data Studio + Azure SQL Database + OData + Revolutions R + SQL Server Data Tools * More [ ] Search Search * No results Cancel Announcing .NET 8 Preview 1 [png] Jeremy Likness February 21st, 20237 6 Welcome to .NET 8! The first preview is ready for you to download: claim your copy of the first .NET 8 preview and start building applications today. Scroll down to see the list of features included in this preview. .NET 8 is a long-term support (LTS) release. This blog post covers the major themes and goals that drive the prioritization and selection of enhancements to develop. .NET 8 preview and release candidate builds will be delivered monthly. As usual, the final release will be delivered sometime in November at .NET Conf. Download .NET 8 Preview 1 Releases of .NET include products, libraries, runtime, and tooling, and represent a collaboration across multiple teams inside and outside Microsoft. The broader themes covered in this blog post do not encompass all of the key scenarios and investments for .NET 8. They represent large areas but are just a part of all the important work going into .NET 8. We plan to make broad investments in ASP.NET Core, Blazor, EF Core, WinForms, WPF, and other platforms. You can learn more about these areas by reading the product roadmaps: * ASP.NET Core and Blazor * EF 8 Roadmap * ML.NET * .NET MAUI * NuGet * Roslyn * Runtime * WinForms * WPF Be sure to check out themesof.net for more details on the GitHub issues and milestones being tracked towards .NET 8. You can download .NET 8 Preview 1, for Windows, macOS, and Linux. Stay current with what's new and coming by reading our What's New in .NET 8 documentation, which will be updated throughout the release. As our team releases new previews, we will include a summary of the known features in it. * Installers and binaries * Container images * Linux packages * Release notes * Known issues * GitHub issue tracker .NET 8 has been tested with 17.6 Preview 1. We recommend that you use the preview channel builds if you want to try .NET 8 with the Visual Studio family of products. Visual Studio for Mac support for .NET 8 previews isn't available yet but is coming soon. Welcome to .NET 8 At the end of last year, we shipped .NET 7, the result of a collaboration between the .NET team and the amazing community that supported the release with over 28,000 community contributions by over 10,000 community members. .NET 7 is the framework of choice for building applications today. The release unifies the platform with native support for ARM64 and enhanced support on Linux. It helps modernize your application through tools like .NET MAUI that enables building cross-platform mobile and desktop apps from the same codebase. It includes improvements to the performance of APIs and makes it easier to build and deploy distributed cloud native apps. .NET 7 simplifies the experience of building apps by reducing the amount of code necessary through improvements in C# 11 and making it possible to create and configure APIs with just a few lines of code. Numerous improvements to tooling from dev tunnels that help debug cloud API integrations to building containers directly from the .NET SDK help developers be more productive. We will be updating What's new in .NET 8 throughout the release. It will describe they key features for the whole release, while the blog posts will focus on new features in each preview release. You can read about what we shipped in preview 1 by scrolling down. First, let's look ahead at what the vision for .NET 8 is. The best platform and tools for cloud native developers We believe .NET developers should be able to get their apps to the cloud quickly, scale their apps without compromising performance, and evolve their apps based on actionable data and feedback about your apps in production. We'll invest in making it easier to manage the full end-to-end experience from local development and testing through continuous integration and deployment. Our goal is to make it easier to implement microservice architectures and build and deploy containers. Cloud native is a term used to describe the architecture and design of applications that are built specifically for deployment in cloud computing environments. The main idea behind cloud native is to take advantage of the benefits provided by cloud computing platforms, such as scalability, elasticity, and self-healing, to create highly scalable and resilient applications. This allows flexibility and avoids potential over-investing in hardware and software to support growth. Many developers associate cloud native with concepts such as microservices, container orchestration (Kubernetes) and "-as-a-service" offerings. A great experience using MAUI and Blazor hybrid for cross-platform mobile and desktop development During the .NET 7 timeframe we released .NET Multi-platform App UI (MAUI) SDK and Visual Studio tooling support. .NET MAUI provides a framework for creating native apps for mobile and desktop devices that run Android, iOS, macOS and Windows with a single C# codebase. In addition to support for XAML UI, you can also use Blazor to build hybrid apps with Razor UI components that can access the native device platforms and be shared across mobile, desktop, and web. The .NET team plans to build on these experiences and focus on improving the quality, stability, performance and integration of the SDK and tooling. Momentum: continued focus on quality and performance based on your input Every release of .NET includes improvements to performance, quality, stability, and ease of use of the APIs, libraries and frameworks the make up the active and growing .NET ecosystem. Many of these improvements were identified and prioritized by customers and community members. .NET 8 will follow the same trend, relying on your highly valued feedback to help guide our vision and drive our focus. Get current and stay current The .NET upgrade assistance is a valuable tool that helps developers migrate their applications from older versions of the .NET Framework to newer versions. The latest version of this tool comes with improved capabilities that support new scenarios and handle more cases. With this tool, developers can now upgrade their applications to .NET 6 or .NET 7 with ease. The tool can automatically detect and suggest changes that need to be made to the code to ensure compatibility with the newer versions of the framework. Additionally, it can handle more complex scenarios, such as upgrading applications that use third-party libraries and integrating with newer platform features. These improvements make the .NET upgrade assistance an indispensable tool for developers looking to keep their applications up-to-date and take advantage of the latest .NET features. This tooling has recently been introduced as a Visual Studio extension to help you upgrade from the comfort of Visual Studio. Targeting .NET 8 To target .NET 8, you first need to ensure you have the .NET 8 SDK installed from the official Microsoft website. Next, you can create a new project and specify that you want to target .NET 8 by setting the appropriate target framework in your project settings. You can also update an existing project to target .NET 8 by changing the target framework in the project properties. To do this, right-click on the project in Visual Studio or your preferred IDE, select "Properties", and then select the "Application" tab. From there, you can choose the target framework version that you want to use. This will set the appropriate target framework: net8.0 Keep in mind that targeting .NET 8 may require changes to your code or dependencies, as there may be changes in APIs or other features from previous versions of .NET. It is a good idea to review the documentation and release notes for .NET 8 to ensure that your code and dependencies are compatible with the new version. What's New in .NET 8 Preview 1 Our first preview is packed with new features you can try out today. Here is a summary of what to expect. For detailed release notes and breaking changes, please read What's new in .NET 8. Native AOT The first NativeAOT features were shipped in .NET 7 and targeted console applications. Ahead-of-Time (AOT) compilation is an important feature in .NET that can have a significant impact on the performance of .NET applications. Thanks to Adeel and Filip for bringing NativeAOT capabilities to macOS for preview 1. The .NET team will focus on refining some of the fundamentals for .NET 8 such as size (see dotnet/runtime#79003). Publishing app with Native AOT creates a fully self-contained version of your app that doesn't need a separate runtime because everything is included in a single file. As of preview 1, this single file is smaller. In fact, Linux builds are now up to 50% smaller. Here are the sizes of a "Hello, World" app with Native AOT that includes the entire .NET runtime: .NET 7 .NET 8 Preview 1 Linux x64 (with -p:StripSymbols=true) 3.76 MB 1.84 MB Windows x64 2.85 MB 1.77 MB NativeAOT will continue to expand and target other application scenarios in .NET 8 so keep watching this blog for future updates! In case you're not familiar with AOT, here are a few benefits AOT provides: * Reduced memory footprint: AOT compiled code requires less memory compared to JIT compiled code, as the JIT compiler generates intermediate code that is not needed in AOT compiled applications. This can be especially beneficial for devices with limited memory, such as embedded systems and mobile devices. * Improved startup time: AOT compiled code starts up faster compared to JIT compiled code, as it eliminates the need for the JIT compiler to generate intermediate code and optimize the code for the specific hardware and software environment. This can be especially beneficial for applications that have to start up quickly, such as system services, serverless "functions" and background tasks. * Improved battery life: AOT compiled code consumes less power compared to JIT compiled code, as it eliminates the need for the JIT compiler to generate intermediate code and optimize the code for the specific hardware and software environment. This can be especially beneficial for devices that rely on batteries, such as mobile devices. .NET Container images .NET developers can use container images to package and deploy their applications in a lightweight, portable format that runs across different environments and can be easily deployed to the cloud. Preview 1 includes the following improvements in how container images can be used for .NET applications: Update default Linux distro to Debian 12: Container images now use Debian 12 (Bookworm) the LTS (Long-term support) version that shipped earlier this year. In order to give our community plenty of time for the transition, we try to adopt it with Preview 1. Tagging change: .NET 8 preview container images will use the 8.0-preview tag (not 8.0) and transition to 8.0 with the Release Candidate releases. The goal of this approach is to more clearly describe preview releases as such. This change was made based on a community request. Run container images with non-root users: Though container base images are almost always configured to run with the root user - a setting which tends to be kept in production - it is not always the best approach. It is a pain to configure each application to have a different user, however, and container images do not come with a non-root user that is appropriate for container workloads. .NET 8 offers a better way. Starting with Preview 1, all container images we publish will be non-root capable. Here is an example of the single line used to run a container as non-root for Dockerfiles: USER app In addition, you can now launch container images with -u app. The default port has changed from port 80 to 8080. This is a breaking change that was necessary in order to enable the non-root scenario, since port 80 is a privileged port. Runtime and libraries Utility methods for working with randomness Both System.Random and System.Security.Cryptography.RandomNumberGenerator have gained utility methods for randomly choosing items from the input set ("with replacement"), called GetItems, and for randomizing the order of a span, called Shuffle. Shuffle is useful in reducing training bias in Machine Learning (so the first thing isn't always training, and the last thing always test): YourType[] trainingData = LoadTrainingData(); Random.Shared.Shuffle(trainingData); IDataView sourceData = mlContext.Data.LoadFromEnumerable(trainingData); DataOperationsCatalog.TrainTestData split = mlContext.Data.TrainTestSplit(sourceData); model = chain.Fit(split.TrainSet); IDataView predictions = model.Transform(split.TestSet); ... Shall we play a game? How about Simon? private static ReadOnlySpan