-1

I am struggling to understand how all these frameworks interact and depend on each other: .NET Core, .NET Framework, ASP.NET Core, MVC, etc.

This discussion leads me to believe that my MVC app uses ASP.NET Core and .NET Framework, but not .NET Core. If that's true, can I run the MVC app without the .NET Core runtime? If not, why is this app still dependent on the .NET Core runtime?

What I tried

I created a new project in Visual Studio 2017 as follows:

  • ASP.NET Core Web Application
  • MVC
  • .NET Framework
  • ASP.NET Core 2.1

I published the app as follows:

  • dotnet publish --self-contained false (to prevent the runtime from being included)
  • Deploy new ec2 instance with windows server 2019
  • Install minimal set of dependencies (IIS, .NET Framework, Rewrite Module)
  • Deploy the published app to IIS

The app did not work at this point. I got a 500.19 with error code 0x8007000d. I got it working by installing the Hosting Bundle. I manually removed a few things that were installed with the hosting bundle, and found that "Microsoft .NET Core 2.1.28 - Windows Server Hosting" is required. I don't know exactly what that is, but it smells to me like the .NET Core runtime is somehow involved here.

Update

When I install the Hosting Bundle, I see a few important things get installed:

C:\Program Files\dotnet\dotnet.exe
C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All\
C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\

When I uninstall the .NET Core Runtime, I am left with just the following:

C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All\
C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\

The app still works at this point. I assume what remains is the ASP.NET Core Runtime, which is different than the .NET Core Runtime. I am just looking to confirm that this app is only dependent on the ASP.NET Core Runtime and .NET Framework, and not at all dependent on .NET Core.

8
  • Some reading here: github.com/dotnet/AspNetCore.Docs/issues/16260 I don't quite understand why you want to use Core 2.1 for a new app when we're at 5 now. Commented Jul 15, 2021 at 20:48
  • I'm working on an existing project. Trying to understand if it is using .NET Core, .NET Framework, or both. This new project is just a simple example to help me understand how all this works (and to make for a simpler SO question). Commented Jul 15, 2021 at 20:53
  • To identify the project framework, just right-click on the project name in the Solution Explorer, then click on properties, look for "Target framework". Another hint for web projects is that in dotnet framework, we have a webconfig file in the root of project, but in .net core we have appsettings instead. Commented Jul 15, 2021 at 21:02
  • @Maddie - Thanks, yes I am aware of that. My ASP.NET Core project is targeting .NET Framework 4.6.2. But does that mean my project is using only .NET Framework 4.6.2, and not .NET Core? Or does it use both .NET Framework and .NET Core in some way? Commented Jul 16, 2021 at 3:08
  • @RoarS. - Thanks, but I don't think that link helps me here. I want to know if I can run a ASP.NET Core app targeting .NET Framework without involving .NET Core at all. So I don't want .NET Core installed on the server or contained in the published app. Commented Jul 16, 2021 at 3:14

1 Answer 1

0

We have a system that has CPU, memory, disk, network card, IO devices, etc. We need a software to manage these resources for us and let us use this system. That software is the kernel. (say Linux)

Now that we can control the hardware we need abstraction on top of it for daily usage for users. We need shell, windowing system, different kind of services and daemons. We call this whole package the Operating System. (say Ubuntu)

Now that we can happily use our computer, we want to write our own applications for our problems or maybe for other's problems. The OS provides us with a programming language and a library of functions and system calls that we can use to create software, just like the OS itself is using them. (say C and glibc)

Suddenly we realize that our software is not portable to other Operating Systems and it has a lot of complex boilerplate codes. So we create a new programming language and provide a new set of library functions but this time way easier to read and understand. (say C# and .NET 5 SDK)

But we have a problem. Our OS does not understand this new language. So we need a layer between our language and the OS. This piece of software must read our program and somehow translate it for the OS. This program is the Runtime. (say .NET 5 Runtime)

enter image description here

OK, let's review. We create an app with C# and .NET. this results in a program that is in the IL language. OS does not understand IL language, therefore we need the .NET runtime to read our IL app and translate it for the OS. But how do we set this up?

We have two options:

  1. We install the .NET runtime on every system that needs to run our app; this way our app becomes portable but it needs the runtime to work.

  2. We include the runtime code inside our app; this way our app does not need the runtime but it won't be portable anymore and since it carries the runtime it will be larger.

Now to clear a few of your confusions:

What is the difference between .NET Framework and .NET Core?

.NET Framework only runs on Windows and has more libraries to use.

.NET Core is cross-platform and has fewer libraries to use but is very fast. It now goes with the name .NET 5 and those extra Windows-only libraries have been added to it.

What is the difference between .NET SDK and Runtime?

SDK provides you with the tools you need to build an app with (SDK includes the Runtime as well).

Runtime is lighter and just runs your app.

What is the difference between .NET Core Runtime and ASP.NET Core Runtime?

.NET Core runtime (.NET 5 runtime now) can only run your console apps and is lighter.

ASP.NET Core runtime can run your web apps.

There are also runtimes for GUI apps capable of running WinForms and WPF apps (Windows-only).

What is MVC?

Model-View-Controller is a design pattern and it is not related to a specific language or framework.

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks, I'm clear on all that. I guess my main question is this: if I have an ASP.NET Core application targeting .NET Framework, does that only require .NET Framework for all steps (compilation, runtime, etc.)? Or does it also require .NET Core for anything (runtime or otherwise)?
Once you choose between Framwork and Core you won't need the other one. So if you target .NET Framework you only deal with .NET Framework SDK and Runtime.
Perfect; can you just help me verify that? I am looking for (at least) one of two things: (1) reputable documentation that clearly states that .NET Core is not needed or (2) steps to run an ASP.NET Core app without .NET Core. As I said in my question, it seems to require Microsoft .NET Core 2.1.28 - Windows Server Hosting. Not sure exactly what it is, but seems related to .NET Core.
"Model-View-Controller is a design pattern and it is not related to a specific language or framework." -- My understanding is that MVC is both a design pattern and a framework. This documentation says "ASP.NET Core MVC is a rich framework for building web apps and APIs using the Model-View-Controller design pattern."
(1) This is the ASP.NET MVC 5 official getting started guide. This guide is for .NET Framework and it does not require .NET Core. (2) This is the official docs for publishing your ASP.NET Core app in a self-contained way.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.