9

In this video, Scott Hanselman interviews a guy from the ASP.NET team. He says that one of the goals of ASP.NET 5, on top of .NET Core, is that the apps won't depend on the .NET Framework and GAC assemblies on the hosting server. Instead, .NET Core libraries will be released via NuGet packages and apps will be deployed with their dependencies.

One of the reasons for this is so Microsoft can quickly release a bug fix or new feature, and we don't have to wait until the new version (of the full framework) is installed on our hosting environment.

My question is:

Are the apps built on .NET Core really independent of the version of .NET installed on the target machine, and can they run even without the .NET Framework installed?

James Ko
  • 32,215
  • 30
  • 128
  • 239
Liero
  • 25,216
  • 29
  • 151
  • 297

2 Answers2

7

Yes, the framework you use in your application is completely independent of the .NET Framework installed on the target server, because the Core .NET Framework is referenced via NuGet packages and can be bundled up for deployment via the DNX Utility, specifically of interest to you will be the dnu publish command.

Here is an excerpt, describing what dnu publish does:


Publish (dnu publish)

The publish command will package your application into a self-contained directory that can be launched. It will create the following directory structure:

  • output/
  • output/packages
  • output/appName
  • output/commandName.cmd

The packages directory contains all the packages your application needs to run.

The appName directory will contain all of your applications code, if you have project references they will appear as their own directory with code at this level as well.


So the .NET Core will exist in the output/packages directory and will not need to be installed on the target server.

Karl Anderson
  • 34,606
  • 12
  • 65
  • 80
  • It's worth comparing with how Unity games can be packaged with enough Mono DLLs to be independent of the framework and can hence function without any .NET or Mono installation on the machine. .NET Core allows apps to be install comparably. – Jon Hanna Aug 16 '15 at 18:33
  • So what is required to be installed on the target machine? – Sean Aug 17 '15 at 10:51
  • @Sean - something to host the application (i.e. IIS). – Karl Anderson Aug 17 '15 at 22:03
  • And if you're using self-host? Then is it a 100% standalone application? – Sean Aug 18 '15 at 05:46
  • but what about the runtime? is the runtime (CoreCLR) also packaged with the app or it has to be somehow present in the target machine? – Liero Aug 19 '15 at 09:08
  • Does this answer still hold true now that they have given up the dnu/dnx thing? – Keith Pinson Aug 31 '16 at 19:31
3

A normal .net core app requires that you install .net core on the machine you wish to run the application on. There is a way to avoid this however, by publishing a self contained app. You can publish your app with the requisite version of .net core included. This will make your app larger, but if you only need one application on a machine to run .net, you need a specific version of .net, or you want to make a portable application, this is a good choice.

Sorrien
  • 143
  • 1
  • 9