-
Notifications
You must be signed in to change notification settings - Fork 108
Discussion for Introduction of new meta-package "Microsoft.AspNetCore.App" #255
Comments
I think packaging Microsoft.AspNetCore.All into the SDK is a very bad decision and one day you guys will remove them from the SDK. |
|
You can always reference individual packages. |
@davidfowl I'm assuming this new metapackage isn't to be used by apps targeting .NET Framework instead of .NET Core. Is that correct? |
@scottaddie yes it's .NET Core only. |
@scottaddie @Eilon actually we're working with the .NET team to get the linker (trimmer) working on ASP.NET Core applications targeting .NET Framework, so that we can allow the meta-package to work on .NET Framework targeted apps too. This is currently in scope for 2.1, although will not make it for the first preview. We'll keep folks posted. |
Is there an explanation for the reasoning behind this change? I feel there is some interesting background missing |
@mungojam sorry for the delay, yes indeed there is some more context I've been meaning to add. There's two main things:
|
@DamianEdwards thanks, those make sense. On the second point, that's an interesting one. What if people are adding later versions for direct use in their projects but don't realise that the meta package also has a dependency on them? Hoping it would lead to a build warning. |
@mungojam indeed NuGet will give you a warning if you force an override of a version range restriction by hoisting the dependency. You can optionally suppress the warning I believe, but by default you'll be notified you're going outside the lines. |
Isn't this going to lead to the same hassles the Azure Functions team is struggling with due to binding redirects? Using any recent version of something as crucial as JSON.NET with Functions v1 is currently very troublesome due to a hard dependency on an old version: |
The restrictions are only applied to our packages, so don't include JSON.NET. Also this is all in your project, so you're in complete control of the overrides if you wish, unlike the situation on Azure Functions where you don't control the host and thus can't unify versions via assembly redirects. |
Gotcha. So it's more a case of, "I'm using ASP.NET Core 2.1.3, so I'm expected to add config extensions 2.1.3," or whatever specific version is defined, rather than "grab the latest and hope it works." |
There is many
Related issue: dotnet/efcore#11920 |
I also had to add a reference to |
@DamianEdwards how are you on supporting this meta-package for the .NET Framework? I'm in the works to change a current ASP.NET Core 2.1 (rc1) to .NET Framework in order to host it inside a windows service. But until now I'm getting the error that the Microsoft.AspNetCore.App is not compatible with net471. Will this work for the RTM? If not, how do you advice on bypassing it? Remove the reference to the AspNetCore.App meta-package and reference the packages individually? |
No the meta package doesn’t support .NET Framework and it won’t for RTM. We don’t have a good way trim the package so your bin folded would contain hundreds of packages. |
@davidfowl so what's the best way to self-host a 2.1 asp.net core web app? I know that a windows service was the recommended way, but it seems that now it won't be possible. Feel free to point me to another project to ask this question. |
@rguerreiro AFAICS; the RunAsService() extension method is there in ASP.NET 2.1: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.windowsservices.webhostwindowsserviceextensions?view=aspnetcore-2.1 |
@markusschaber yes it's true, but since the meta-package Microsoft.AspNetCore.App (which is the recommended package to use from 2.1 onward) is not supported with the .NET Framework (and won't be in the near future) I'm not able to convert my current web app from netcoreapp2.1 to net471 which is a step needed to run it as a windows service (as you can see here) |
@rguerreiro AFAICS, the meta-package just pulls in other packages transitively, it has no content on its own. So it should be possible to just reference the required nuget Packages directly. |
No, you just won’t be able to use the shared framework or meta package. Just reference what you need directly instead. So instead of this:
You do this:
Metapackages and the shared framework are completely optional. You can always choose to reference your dependencies explicitly instead. That will work on both the full framework and .NET Core. |
.NET Framework is not required to run in a windows service, netcoreapp2.1 should work fine. |
If I have understood correctly, the Some questions: a) How should I select the version for those App-package included packages that I also need in other projects of the same solution? b) What if a newer runtime gets installed to the host? Then the web app references a newer version of the same package than the class library. For example c) What are the best practices to specify version numbers of the SDK and runtime? For example, I have a web app hosted in Azure App Services, and some class libraries that the web app depends on. Should I always...
If I don't spec the If I do spec the
..or should I even publish a self-contained application? |
And another: is it ok to reference the |
@rihei good questions! We realized that the version constraints in For your class libraries that reference the "atom" packages that are otherwise included in Azure App Service will always lag slightly when it comes to releases, but for patches if you follow the above you shouldn't be broken because you're always only targeting the major.minor at build time, and relying on runtime roll forward to get onto the latest patch. Or, your referencing patched versions of "atom" packages which will end up in your output folder, so you have them with you. For total isolation though, self-contained publish is the most conservative approach. You take everything you need with you, but now you won't get the benefit of runtime updates without re-publishing your application. Hope this helps. |
Hi! @DamianEdwards, thank you for the answers! A couple of things are still a bit unclear for me:
|
No.
It means you need to have the target runtime installed on both your deployment environment and the development environment.
It's a minimum. The runtime will still roll forward to the latest patch version at runtime (2.1.x where x is the highest installed patch on the target). This behavior can be disabled but that's the default.
We recommend referencing individual packages in class libraries. Reason being that the meta package only works on .NET Core and if you want to run everywhere that ASP.NET Core runs you need to be netstandard 2.0. Test projects should reference the
Because the 2.1.0 shared framework references 2.1.0 versions of all the assemblies. If you update the packages to 2.1.1, those packages will win and you will stop using the shared framework. Essentially, you end up running with the 2.1.1 dlls deployed locally instead of running on the shared framework. Ideally, patches would be delivered via the SDK and runtime install only but we currently publish packages because of .NET Framework and other edge scenarios but it ends up causing this confusion. |
Is there any advantage in using the If I use the What is the recommended way ( |
The shared framework
Not automatically, only if you actually have something that loads the assembly. But yeah, with the .NET Framework you would end up with a lot assemblies that you wouldn’t need since that assembly stripping is not available.
If you are using .NET Core, regardless of whether you run inside a container or not, you should just reference |
I might be wrong, but I think the advantage is a smaller deployment package as well as the ability to get bug fixes by updating the runtime instead of updating all the packages in your application. In addition to getting fixes via a runtime update, you can be sure that all packages within the metapackage are compatible (and presumably thoroughly tested to work well together). I'm with you on the thought process, include just what you need, which I thought was a main tenet for creating .NET Core in the first place. |
I'm closing as this repository is about to be archived in favor of https://github.com/aspnet/AspNetCore. If you still have concerns or questions about Microsoft.AspNetCore.App, please open a new issue on the new repo. |
Discussion issue for aspnet/Announcements#287
The text was updated successfully, but these errors were encountered: