1
votes

When doing a dotnet --info I get the following output (excerpt shown):

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Why does the above command ouput Microsoft.AspNetCore.All and Microsoft.AspNetCore.App as runtimes?

2

2 Answers

1
votes

There's two parts to the answer here:

  1. Why is ASP.NET Core listed in runtimes?

That's because the dotnet --info command looks inside the .NET Core installation to find all runtimes. ASP.NET Core is distributed as a runtime (or shared framework) along with .NET Core. If you look in your installation, there's C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All and C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App directories that indicate that Microsoft.AspNetCore.App and Microsoft.AspNetCore.All are shared frameworks included with .NET Core.

  1. Why is ASP.NET Core a runtime?

Say there's a security issue in ASP.NET Core. Microsoft releases an update. If ASP.NET Core was just a normal package, you would need to rebuild all your projects with the updated versions of ASP.NET Core to pick up the security fixes.

But ASP.NET Core is a runtime that's included with .NET Core. What that means is that when the installation of .NET Core is updated, your application will automatically switch over to the newer version of ASP.NET Core. So you wont have to rebuild your applications to get security fixes. You just need to update your .NET Core/ASP.NET Core installation. This makes it easier for applications to get security fixes.

1
votes

AspNetCore applications that target the .NET Core framework need a lot of nuget packages to be bundled to work. This would be the case if you want to run an ASP.NET Core application on the NETCore.App runtime.

To avoid that, two sepcial runtimes are created that bundle the base ASP.NET Core packages with the runtime (AspNetCore.App) and one that bundles everything (AspNetCore.All). Those are needed for an AspNetCore app that doesn't reference the individual nugets but instead references the Microsoft.AspNetCore.App/All metapackages.

I can't find a definitive source on this, but reading between the lines I think this is how it works based on https://dotnetcoretutorials.com/2017/08/27/microsoft-aspnetcore-package/.