Does ASP.NET use a different .NET framework than desktop? - asp.net

I Was just reading this post: http://blogs.msdn.com/b/dotnet/archive/2014/12/04/introducing-net-core.aspx
It left me a bit confused since the first picture in the article seems to imply that .NET desktop apps and ASP.NET don't share the same framework implementation. I was always under the impression that it was. Any ideas?

They use the same .NET framework.
But they don't have to. And this is the way the .NET ecosystem is evolving right now - ways to avoid using the full (ever growing) .NET framework for everything.
As a bonus, the new .NET Framework Core is open-sourced. This is not entirely posssible with the whole .NET framework, since it includes a whole lot of licenses and proprietary technologies.
Given all that, it's now possible to deploy very light-weight web applications using ASP.NET, not even having to use IIS (thanks to OWIN). You only have to include the packages you need - instead of having a single monolithic runtime and BCL, there's hundreds of NuGet packages you choose to use (or not).

You will have to better define "the same framework implementation", as they (full .NET Framework and .NET Core) are built from the same code base with different configuration, and also host your web applications in a slightly different way.
The most important getaway of that article should be "ASP.NET 5 can run on both .NET Framework 4.6 and .NET Core 5". You get different benefits from each runtimes,
.NET 4.6 gives you best compatibility against previous .NET runtimes.
.NET Core 5 gives you flexibility on running multiple customized DNX side by side, and portability to Linux and OS X.
Unfortunately Microsoft decides to limit desktop apps to .NET 4.6, but Mono guys have demonstrated possibility to run some (such as WinForms apps) on .NET Core,
https://github.com/akoeplinger/mono-winforms-netcore

Related

.NET6 vs .NET Core 3.1 compatibility

Is it safe to have a .NET6 application which references a .NET Core 3.1 NuGet library?
I tested this case using a simple console application. Everything looks good and there are no errors/warning. However, I haven't found any specific information so prefer to make sure.
This is important, as one of my providers offers only a .NET Core 3.1 NuGet package. Knowing the company it'll take them a year or so to prepare a .NET6 / .NETStandard version.
There is a good chance that your .NET Core 3.1 library will run without any compatibility problems as part of your .NET 6 application.
Quoting the .NET fundamentals article Changes that affect compatibility (emphasis mine):
Throughout its history, .NET has attempted to maintain a high level of
compatibility from version to version and across implementations of
.NET. …
Along with compatibility across .NET implementations, developers
expect a high level of compatibility across versions of a given
implementation of .NET. In particular, code written for an earlier
version of .NET Core should run seamlessly on .NET 5 or a later
version. In fact, many developers expect that the new APIs found in
newly released versions of .NET should also be compatible with the
pre-release versions in which those APIs were introduced.
However, compatibility is not guaranteed. The article goes on to say:
This article outlines changes that affect compatibility and the
way in which the .NET team evaluates each type of change.
Understanding how the .NET team approaches possible breaking
changes is particularly helpful for developers who open pull
requests that modify the behavior of existing .NET APIs.
Furthermore, in an answer to the question Clarification on backwards compatibility of .NET Core, a member of the .NET runtime team says:
We do not guarantee 100% compatibility between major versions. This is true for both ASP.NET Core and the runtime itself. We
intentionally make breaking changes where we believe that they are
necessary to move the platform forward and the cost of the .NET
ecosystem adjusting to them is low enough.
Breaking changes that could potentially affect the compatibility of your .NET Core 3.1 library are those that are documented for .NET 5 and .NET 6.
But, if you are not experiencing any problems with your .NET Core 3.1 library, it would appear that none of the documented compatibility problems apply.
Ultimately, of course, you'll have a higher degree of confidence in the library when your vendor provides one that has been updated for .NET 6.
Finally, with the introduction of .NET 5, there became a lesser need for .NET Standard:
.NET Standard is a formal specification of .NET APIs that are
available on multiple .NET implementations. The motivation behind .NET
Standard was to establish greater uniformity in the .NET ecosystem.
.NET 5 and later versions adopt a different approach to establishing uniformity that eliminates the need for .NET Standard in most
scenarios. However, if you want to share code between .NET Framework
and any other .NET implementation, such as .NET Core, your library
should target .NET Standard 2.0. No new versions of .NET Standard will
be released, but .NET 5, .NET 6, and all future versions will continue
to support .NET Standard 2.1 and earlier.

Referencing .NetCore project from .Net Framework

.Net Core version (2.0+)
.Net Framework version 4.5+
, Visual studio 2019
Currently i have an issue where the UI is made in .Net framework but the back end code is currently in .net Core.
I looked at standard and it looks like .Net core can reference standard but not the other way around.
Aside from converting the UI to Core or the backend to .Net framework. Is there a way around this issue?
Currently the two (.net framework and core) do not communicate with each other.
What i have is a .Net framework legacy monolith application, which has been revamped in core (but no UI). In the future we'll go web/ cross platform but temporary we'd like the new core code to connect with Desktop Ui as the UI is going to take some time to complete.
Regards
Unfortunately this will not play out exactly as you hope for.
First of all, make sure your projects are targeting .net Standard.
Second, check out this blog here. Theres a matrix of support and compatibility.
Good luck on your endeavor!

What does lightweight mean in .net Core

I am reading an ebook about Docker and Microservices. It referred the .net core was lightweight compared with traditional .net standard.
I don't quite get the story behind it. Can someone give some explanation about this?
This is because .Net Core is optimized for microservices and dockers.
In short, .Net Core doesn't offer as many things as another classic implementation of .Net Standard, reducing its size which even allows for an app to be packaged with all dependencies (and so not needing any installation of .Net on the running machine). This is why I think it could be called lightweight.
See :
https://msdn.microsoft.com/en-us/magazine/mt842506.aspx
https://learn.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server
About light weight of .net core app
I am reading an ebook about Docker and Microservices. It referred the
.net core was lightweight compared with traditional .net standard.
I think here you are referring to .net core is lightweight than .net frameworks as .net standard are just API specifications for implementing base class libraries by different frameworks.
Please refer to below link for more information:
https://www.infoq.com/news/2017/10/dotnet-core-standard-difference/
https://medium.com/wolox-driving-innovation/net-core-vs-net-framework-a694f1fbdb26
Now coming back to why .net core framework is lightweight .net 4.5 or other frameworks as it's modular. When you create or run an application you don't need to install all dependencies which you do not need unlike .net 4.5 or other frameworks where everything is installed.
Basically, .Net framework has been split into individual pieces implemented using CoreFX for .net core framework which makes .Net core lightweight.
Link for details - https://www.tutorialspoint.com/dotnet_core/dotnet_core_managed_extensibility_framework.htm

Can I use many DNX versions?

I've created a new ASP.NET 5 project and I faced with something that I didn't understand well about how the new ASP.NET works.
In my references there are DNX 4.5.1 and DNX Core 5.0. When I install a new package from Nu-Get, some packages install successfully in both and some tell me they aren't supported by DNX Core 5.0.
Can I use many versions of DNX for supporting my packages or I must bound the things with DNX Core 5.0 to enjoy the advantages of ASP.NET 5, like cross-platform and others?
ASP.NET 5 projects are multi-targeted, which means you can compile for multiple platforms simultaneously. In your case .NET 4.5.1 targets ASP.NET 5 on the full .NET runtime (4.5.1) and .NET Core (5.0). When you compile your project, ASP.NET 5 actually creates output for both of these targets so - assuming you get the code to compile for both platforms - the application can run on either of them. It's possible to run additional targets to your projects.
When you actually run your application though, you have to pick a specific version of the .NET runtime you want to run under. In Visual Studio there's a drop down in the project settings where you can select that runtime that actually executes. When you use command line publish you also specify which platform to publish to with a parameter (if omitted it uses the active DNX runtime I believe).
As to the differences - .NET Core is a trimmed down version of the full .NET runtime, that is cross-platform and can run on Windows and other platforms like Linux and OSX. Because it has to run on other platforms a lot of the platform specific Windows features are not supported in this runtime, and as the platform is still evolving some APIs are simply not implemented yet in .NET Core. This is the reason you are likely to see many compile errors when you target .NET Core with existing code/libraries. In order to run on .NET core existing .NET code typically needs at least some minor adjustments to account for the smaller API footprint and potentially serious redesign to work around missing functionality.
If you need to use existing code and depend on assemblies/NuGet packages that are based on previous versions of .NET you have to stick with the full .NET version. You can still take advantage of the new ASP.NET 5 features and eco-system, as well as getting the benefit of the full .NET runtime and full API surface you are used to from previous .NET versions. The downside is that the runtime is Windows only and has a bigger resource footprint.
.NET Core is a new runtime and you should treat it as such. Migrating to this platform is likely not a trivial task. The benefits of this platform is a much leaner footprint and that it can run across multiple OS platforms.
It's likely that it'll take some time for the full potential of .NET Core to come to fruition as Microsoft expands the feature set and cross-platform compatibility but we won't really know what this will look like since it is still in Beta (well RC but it's really a beta with major changes still coming in RC2).

What's the difference between ASP.NET 5, .NET Core, and ASP.NET Core 5? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I'm confused on the distinction between these terms:
ASP.NET 5 (now renamed ASP.NET Core and released as 1.0, not 5.0)
ASP.NET Core 5
.NET Core
Can anyone briefly explain it?
ASP.NET 5 (now ASP.NET Core 1.0)
Is the next generation of ASP.NET that provides a familiar and modern framework for web and cloud scenarios. It includes the next versions of ASP.NET MVC, Web API, Web Pages and SignalR. It is a high-performance and modular design, and supports full side by side to make it seamless to migrate from on premise to the cloud. These products are actively developed by the ASP.NET team in collaboration with a community of open source developers. Together we are dedicated to creating the best possible platform for web development.
Update: It has been renamed from ASP.NET 5 to ASP.Net Core 1.0.
.NET Core:
.NET Core is the small optimized runtime that is the basis of ASP.NET Core. It currently runs on Windows, Linux, and Mac. It is a high-performance and modular design, and supports having several applications on a web server each one with its own copy of the .NET Core runtime, enabling a full side by side experience, and that will make it easy to adopt new .NET Core versions without affecting other apps, and this makes .NET Core architecture a leap forward from the current classic .NET 4.6. These products are actively developed by the .NET team and in collaboration with a community of open source developers. Together we are dedicated to improving and extending the .NET platform with new features and for new scenarios.
.NET Core has two major components. It includes a small runtime that is built from the same codebase as the .NET Framework CLR. The .NET Core runtime includes the same GC and JIT (RyuJIT), but doesn’t include features like Application Domains or Code Access Security. The runtime is delivered on NuGet, via the Microsoft.CoreCLR package.
.NET Core also includes the base class libraries. These libraries are largely the same code as the .NET Framework class libraries, but have been factored (removal of dependencies) to enable us to ship a smaller set of libraries. These libraries are shipped as System.* NuGet packages on NuGet.org.
For more information, see Introducing .NET Core
ASP.NET 5 is a new platform based on DNX (.NET Execution Environment). DNX is on duty for loading CLR. There're two kind of DNX now: for Full .NET CLR (from .NET Framework) and for CoreCLR. CoreCLR is a new cross-platform light CLR (runs on Win/Linux/Mac).
ASP.NET 5 works seamlessly on CLR/CoreCLR as DNX abstracts it from runtime being used.
IL assemblies build for old .NET still be used with new CoreCLR and DNX. So ASP.NET 5 functionality is a bunch of nuget packages.
Strictly speaking there're no such things as "asp.net core 5" and ".net core" now (as CLR != .NET). There's "ASP.NET 5 running on CoreCLR".
IMO it's better to consider "ASP.NET 5" as ".NET 5".
There is no ASP.net Core 5 yet. In fact, Microsoft decided to change the .net 5 (The version after 4.6) to a brand new name : .net Core
So the version released on June 2016 is actually .net Core 1.0
The reason why they gave it a new name is the very fundamental change they've made in it.
These fundamental changes include :
Cross platform: It works on Windows/Linux/Mac as opposed to the previous versions working only on Windows/IIS
It's fully open source now and you can see every bit of its code in GitHub.
Its performance (especially in ASP.net) is way better than the previous versions, as you can easily customize your request pipeline according to what you need (through middlewares).If you are familiar with nodejs and ExpressJs framework it's so similar to ExpressJs. In some cases it performs better than NodeJs. Have a look into this benchmark.
It's designed with a modern mindset of app development, for highly distributed cloud applications, microservices and containers (docker)
ASP.NET Core is the next version of ASP.NET MVC 5, Yes, the version number is confusing! It has gone through a few name changes. It started as ASP.NET vNext, then changed to ASP.NET 5, next was renamed to ASP.NET MVC 6 and eventually became ASP.NET Core 1.0.
The main difference between ASP.NET and ASP.NET Core are
Platform Independent Features, ASP.NET Core provides hosting in multiple platform (Win / Linux / Mac OS) hosting (Cross platform).
Introduced new lighter version of CLR and assemblies with non-dependent frameworks.
Frameworks are a complete rewrite (removal of dependencies with DI) and Its Open source Project.
Project default project template is updated with Type scripts insted of JQuery.
Improved new security features and completely decoupling for all its dependent framework.
Updated project template with angular and json based configuration & enhanced packages support with node modules.
Supports for Visual Studio IDE ( 2015 v3 + 2017 and above) & VS Code IDE.
If you are new to this, Please refer Here
By the way there is also a Mono runtime as an alternative to CoreCLR in the linux apt and Docker package. Mono is still the default when it's up to installing DNX. The whole thing about the "Core" is that it's a cross platform .net framework and at some point hosting an ASP.NET 5 app will not make use of IIS, Apache, Mono etc., but the DNX and Libuv.
.NET Core 1.0 is not the next version of .NET 4.6.2 (Full .NET Framework). If it is the next version it should have more features than the previous version. But according to Microsoft .NET Core 1.0 doesn't have some of the features .NET 4.6 got. That's why they named it as .NET Core 1.0 instead of .NET 5.
In ASP.NET Core 1.0 they are using .NET Core 1.0 as reference. That means we don't need to install .NET framework to run our ASP.NET Core 1.0 application.
You can find more updated information here.
ASP.NET Core i.e 1.0/2.0...
ASP.NET Core is an open-source, cross-platform framework for building modern, cloud-based web apps on Windows, macOS, or Linux.
ASP.NET i.e ...4.5/4.6
ASP.NET is a mature framework that provides all the services needed to build enterprise-grade, server-based web apps on Windows.
There is no such thing as ASP.NET Core 5 and .NET Core.
ASP.NET 5 is same as ASP.NET Core 1.0
Please refer to the link:
https://learn.microsoft.com/en-us/aspnet/core/choose-aspnet-framework?view=aspnetcore-2.0

Resources