Questions tagged [.net-5]

The previous version of .NET, successor of both .NET Core and .NET Framework. Use this tag for questions about .NET 5 and .NET 5's formal specification.

For the original announcement of .NET 5, and for more detailed information, please refer to the official communication from Microsoft.

What

is the next big release to the .NET family after .NET Core 3.0. There is now just one .NET going forward, which is usable across many platforms. These platforms currently include Windows, Linux, macOS, iOS, Android, tvOS, watchOS, and WebAssembly, with more to be announced.

When

was released November 10, 2020. The first preview was made available on March 16, 2020. It will be supported with future updates to Visual Studio 2019, Visual Studio for Mac, and Visual Studio Code.

Why

.NET 5 is the next step forward with .NET Core. The project aims to improve .NET in a few key ways:

  • Produce a single .NET runtime and framework that can be used everywhere and that has uniform runtime behaviors and developer experiences.
  • Expand the capabilities of .NET by taking the best of .NET Core, .NET Framework, Xamarin, and Mono.
  • Establish a single code-base that developers (Microsoft and the community) can work on and expand together and that improves all scenarios.
  • Version 4 was skipped because it would confuse users that are familiar with the .NET Framework, which has been using the 4.x series for a long time.
  • 'Core' was dropped to emphasize that this is the main implementation of .NET moving forward

This new project and direction are a game-changer for .NET. With .NET 5, your code and project files will look and feel the same no matter which type of app you’re building. You’ll have access to the same runtime, API, and language capabilities with each app. This includes new performance improvements that are being committed to CoreFX regularly.

Everything you love about .NET Core will continue to exist:

  • Open source and community-oriented on GitHub.
  • Cross-platform implementation.
  • Support for leveraging platform-specific capabilities, such as Windows Forms, WPF on Windows, and the native bindings to each native platform from Xamarin.
  • High performance.
  • Side-by-side installation.
  • Small project files (SDK-style).
  • Capable command-line interface (CLI).
  • Visual Studio, Visual Studio for Mac, and Visual Studio Code integration.

Here’s what is new:

  • Developers will have more choice of runtime experiences.
  • Java interoperability will be available on all platforms.
  • Objective-C and Swift interoperability will be supported on multiple operating systems.
  • CoreFX will be extended to support static compilation of .NET (ahead-of-time; AOT), smaller footprints, and support for more operating systems.
  • .NET 5 shipped in November 2020, with the intention to then ship a major version of .NET once a year, every November.
  • This is a non LTS version, hence not recommended for production. .dotnet community planned to release every LTS version as a even versions, .i.e., .net6, .net8...

Announcements

3059 questions
305
votes
4 answers

When to use record vs class vs struct

Should I be using Record for all of my DTO classes that move data between controller and service layer? Should I be using Record for all my request bindings since ideally I would want the request sent to the controller to be immutable for my…
frictionlesspulley
  • 11,070
  • 14
  • 66
  • 115
106
votes
7 answers

.NET 5 not available in Visual Studio 2019

I have downloaded and installed .NET Core 5.0 SDK (v5.0.100-preview.1) in my Visual Studio 2019. But it is not available in Target framework. Am I missing something?
Hamid Noahdi
  • 1,585
  • 2
  • 11
  • 18
96
votes
8 answers

Equivalent to UserSettings / ApplicationSettings in WPF for newer .NET versions

What is the prefered way for persisting user settings for WPF applications with .net-5 , .net-6.0, .net-7.0 or .net-core>=3.0? Where are the .NET user settings gone? Created WPF .Net Core 3.0 Project (VS2019 V16.3.1) Now I have seen there is no…
MarkusEgle
  • 2,795
  • 4
  • 41
  • 61
90
votes
5 answers

error CS8773: "Feature 'global using directive' is not available in C# 9.0" after downgrade from net6.0 to net5.0

I have a project that was initially created for .NET 6 but then I needed to downgrade it to .NET 5. I changed Target framework in Project Properties and tried to compile. As a result I received a bunch of the errors: GlobalUsings.g.cs(2,1,2,29):…
Yuriy Gavrishov
  • 4,341
  • 2
  • 17
  • 29
79
votes
1 answer

Ref folder within .NET 5.0 bin folder

What is the ref folder when compiling .NET 5.0 application? I mean this one: [project_path]\bin\Debug\net5.0\ref\
Alek Depler
  • 1,182
  • 2
  • 6
  • 11
65
votes
2 answers

Equivalent of JObject in System.Text.Json

I have DTO class that has a property of type JObject. This DTO class is send/receive over HTTP between multiple services. JObject is used because the ExtractedData does not have predefined properties public class MyDTO { public JObject…
LP13
  • 30,567
  • 53
  • 217
  • 400
48
votes
13 answers

Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0 in Azure Functions

I have an API and a separate Azure Functions app. I upgraded my API app to .NET 5 and it's working fine. In the API app's solution, I have class library projects that I also reference in my Azure Functions app. These class libraries are…
Sam
  • 26,817
  • 58
  • 206
  • 383
41
votes
2 answers

How can I eliminate warning NETSDK1137 in a .NET 5 WPF program?

I have the following warning in a WPF program that used to be built for .NET Framework 4.5 but is now being built for .NET 5. Warning NETSDK1137 It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the…
H2ONaCl
  • 10,644
  • 14
  • 70
  • 114
41
votes
3 answers

How to pretty print using System.Text.Json for unknown object

Using System.Text.Json i can pretty print json using serialization option. var options = new JsonSerializerOptions{ WriteIndented = true }; jsonString = JsonSerializer.Serialize(typeToSerialize, options); However, I have string JSON and don't know…
LP13
  • 30,567
  • 53
  • 217
  • 400
37
votes
1 answer

What changed in .net 5 that makes it not throw when changing dictionary values in foreach

In .NET<5 and .NET Core 3.1 the following code var d = new Dictionary { { "a", 0 }, { "b", 0 }, { "c", 0 } }; foreach (var k in d.Keys) { d[k]+=1; } throws System.InvalidOperationException: Collection was modified; enumeration…
tymtam
  • 31,798
  • 8
  • 86
  • 126
37
votes
1 answer

.Net 5 Publish Single File - Produces exe and dlls

I am using VS 2019 and .Net 5 to build a simple console application. I wanted to share this app with a friend so I tried to publish it as a single file but I keep getting some extra DLLs that the executable needs to run correctly. Edit: Switching…
Bailey Miller
  • 1,376
  • 2
  • 20
  • 36
36
votes
8 answers

.NET Core equivalent to Thread.Abort

Background I have a Service abstraction. Each service has it own WorkItem. WorkItem able to start with some data. The service is limiting the excution time of WorkItem. Let's say that a single workitem can takes up to 60 seconds. After this, the…
No1Lives4Ever
  • 6,430
  • 19
  • 77
  • 140
35
votes
2 answers

Docker image for .net 5

Typically I use following images for .net core 3.1 and it works fine. FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build I have for experimental reason started a new .net 5…
Peter Jacobsen
  • 618
  • 2
  • 6
  • 18
32
votes
15 answers

Visual studio 2019 “Unable to connect to web server 'IIS Express'”

I attempt to lunch my ASP.NET Core project in Microsoft Visual Studio 2019 and got this error: "Unable to connect to web server 'IIS Express'" Visual Studio 2019 Version 16.9.5 .Net 5.0
32
votes
4 answers

How to enable C# 9.0-preview

I have downloaded and installed v5.0.0-preview.5. My project is targeting net5.0 but C# 9.0 is not working. How can I enable C# 9.0?
Jerzy Grzelec
  • 341
  • 1
  • 3
  • 6
1
2 3
99 100