Recently, I've read about Use the ASP.NET Core shared framework and I'm wondering:
<FrameworkReference Include="Microsoft.AspNetCore.App" />
?For example, I'd created a simple console application and published it with self-hosted
options. The output size was on 20mb greater with <FrameworkReference Include="Microsoft.AspNetCore.App" /
even If I don't explicitly use any of Microsoft.AspNetCore
packages
NET Core application side by side with your application seamlessly. It is a general-purpose development platform that consists of several components. These include the managed compilers, the runtime, and the base class libraries. It also includes many application models, such as the ASP.NET Core.
Razor is a markup syntax for adding server-side logic to web pages. This package contains MSBuild support for Razor. Learn more about Target Frameworks and . NET Standard.
WebApplication Class (Microsoft.AspNetCore.Builder) The web application used to configure the HTTP pipeline, and routes.
The shared framework is a collection of assemblies that is included in the runtime and as such does not need to be resolved individually through NuGet. You can think of it as a NuGet package though, because the handling is very similar. The primary difference of course is that it doesn’t need to be downloaded from NuGet because it is available locally with the runtime.
Since it is distributed with the runtime, that also means that you cannot reference a specific version of it. Instead, you always get the version that is included in the available version of the runtime. This has the benefit that the contents will automatically update when the runtime is updated, so your application that depends on one of the shared frameworks will also just roll forward at runtime.
Attempting to answer that in detail is out of the scope of a Stack Overflow answer since this is some deep MSBuild logic. If you are interested to find out, you can checkout the dotnet/sdk repo though which contains everything that makes the Microsoft.NET.Sdk
project SDK and its subtypes work, including the FrameworkReference
implementation.
First of all you should know that there is no way to use e.g. ASP.NET Core without using that framework reference. So it’s not like you have much of a choice. Most of the time, you won’t be adding the framework reference yourself though; ASP.NET Core applications use the Microsoft.NET.Sdk.Web
project SDK which already includes the framework reference by default. You will only need to add the framework reference yourself if you want to add ASP.NET Core references in a non-Web project (for example in a class library for ASP.NET Core).
Apart from that, there aren’t many things you will have to keep in mind though. Just remember not to use a version and keep your SDK and runtime updated to make sure that you have all the latest security patches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With