.NET Core is not listed - asp.net-core

I wanted to create a new ASP.NET Core app targeting the new .NET Core 1.0.
First, in Visual Studio 2015 Update 3, I don't see .NET Core listed
And this is what I'm seeing in project.json file. Looks like I'm targeing dotnet5.6
Is it safe to assume this is all correct?
And if this is correct, could it possibly be more confusing?

The pulldown has no meaning for .NET Core projects as it doesn't use it. Only what's in project.json matters for .NET Core / .xproj projects.
netcoreapp1.0 target framework moniker (short TFM) is .NET Core project for executables (ASP.NET Web Application or .NET Core Console Application). netstandard1.x (see this matrix for api surface of netstandard TFM) is for class libraries.
The import section just tells nuget to also restore packages which target dotnet5.6 (old TFM for .NET Core Library, which is now replaced with netstandard1.x) and portable-net45-win8, which are also compatible with .NET Core. These allow you to install packages which are compatible but are not yet repackaged for netstandard1.x.

Related

Helper library for ASP.NET Core 5 - NuGet packages not available?

I'm writing a helper library for ASP.NET Core 5 (with .NET 5) and I need some APIs from the package Microsoft.AspNetCore.Server.Kestrel.Core. However, the package is only available in version 2.2 - not version 5.
Is ASP.NET Core no longer distributed via NuGet? And if so, how does one get the APIs with ASP.NET Core 5.
Side note: I found that I could use Microsoft.NET.Sdk.Web as SDK for the project but I'm unsure whether this is a valid/good/correct approach when writing a library.
Is ASP.NET Core no longer distributed via NuGet? And if so, how does one get the APIs with ASP.NET Core 5.
That's correct. The core of ASP.NET Core (no pun intended...) ships with .NET Core >= 3.0 as a shared framework. You can add a single FrameworkReference to your nuget package to pull this in. See https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-5.0&tabs=visual-studio#migrate-libraries-via-multi-targeting for more information.
Some background can be found here https://github.com/dotnet/aspnetcore/issues/3756

It's very confusing.. I was creating .net core web application and can see .NetFramework with .NetCore support

I was creating .net core web application and can see .NetFramework with .NetCore support. But I didn't choose .Net Standard. I don't understand. Please see the image asp.net core web application
This is Microsoft naming at work here. 😁 There are two dotnet frameworks: the "full" framework, which you selected, and the dotnet core framework.
Before dotnet core and all it's optimized, multiplatform goodness, there was the dotnet framework (refered to as the legacy or full framework). This is the predecessor of dotnet core. This full framework runs only on Windows and the computer it runs on needs the dotnet framework runtime.
Do not worry, the "full" in full framework comes from the transition period between the old dotnet framework and dotnet core. When dotnet core was version 1.0, it did not have all the functionality of today. So some developers called it the full framework (which had everything you needed to run your application) and the newer dotnet core framework which had only the basics.
You can see if you are running the legacy framework if there is the <TargetFramework>netXXX</TargetFramework> present in your solution/project file. The lastest version of the full dotnet framework is 4.8 (net48).
After that it switched to dotnet core 1.0 - 3.1. I'm not entirely sure how that's referenced in the solution/project files.
As a last remark, Microsoft had a great naming idea: the next version of dotnet core is named dotnet 5. They want to get back to the original name with this next version. Do keep in mind that you cannot easily upgrade from dotnet 4.X to dotnet 5. The day to day code looks very much alike, but the underlying engine is completely rewritten.
As far as I know, before .net core 3.0, asp.net core is support on .net framework. This is the reason why you could create .net core 2.1 on the .net framework.
But after 3.0, asp.net core not support .net framework. You could only create it on .net core framework.
More details, you could refer to this article and this github issue.

.NET Core SDKs are not detected when creating an ASP.NET Core Web Application

I'm having trouble with Visual Studio 2019 not finding the .NET Core SDKs.
I have installed a preview version of .NET Core 3.0 (v.9) and removed all the previous version of .NET Core SDKs.
When I am trying to create an ASP.NET Core Web Application from the template form in VS2019, I am getting the following error below:
No .NET Core SDKs were detected, ensure they are included in the environment variable 'PATH'. https://i.imgur.com/ye1rliG.png
I have checked on my environment variables and the paths to the dotnet core folders are available. https://i.imgur.com/Jz8T9eQ.png
Also, I have the Use previews of the .NET Core SDKs in the Tools->Options->Environment->Preview Features, selected.
Has anyone else got any ideas where I can take it from as I have followed Microsoft help guide on this issue but to no avail?

.NET Core vs ASP.NET Core

What exactly is the difference between .NET Core and ASP.NET Core?
Are they mutually exclusive? I heard ASP.NET Core is built on .NET Core, but it can also be built on the full .NET framework.
So what exactly is ASP.NET Core?
Update 2020: Do note that ASP.NET Core 3 and higher now depend on .NET Core and can no longer be used on .NET Framework. The below description is for ASP.NET Core 1.x-2.x; the layer separation still holds true for ASP.NET Core 3.0 but the ASP.NET Core layer can no longer be used on top of .NET Framework in 3.0+.
.NET Core is a runtime. It can execute applications that are built for it.
ASP.NET Core is a collection of libraries that form a Framework for building web applications.
ASP.NET Core libraries can be used on both .NET Core and the "Full .NET Framework" (which has shipped with windows for many years).
The confusing part is that an application using the libraries and tools of ASP.NET Core is usually referred to as "ASP.NET Core Application", which in theory doesn't say if it is built for .NET Core or .NET Framework. So an "ASP.NET Core Application" is also a ".NET Core Application" or a ".NET Framework Application".
This image shows the relation of the involved technologies (taken from this blog post)
Here you can see that ASP.NET Core is built "on top of" both .NET Framework and .NET Core, while "ASP.NET" (now often referred to as "classic ASP.NET") is .NET Framework only.
ASP.NET Core using .NET Core - all dependencies are self-contained, can use most NuGet packages, can't use Windows-specific packages, can execute on Windows, Linux, and Mac.
ASP.NET Core using .NET Framework - most dependencies are self-contained, only executes on Windows, will have access to Windows-specific NuGet packages, needs the .NET framework version which is targeted installed on the machine.
ASP.NET Core is one of the workloads supported by .NET Core.
From .NET Core guide:
By itself, .NET Core includes a single application model -- console apps -- which is useful for tools, local services and text-based games. Additional application models have been built on top of .NET Core to extend its functionality, such as:
ASP.NET Core
Windows 10 Universal Windows Platform (UWP)
Xamarin.Forms
The .NET Framework is on its last release. There will not be another one after 4.8. Microsoft will continue with .NET Core. From this time you should prefer .NET Core on your projects.
Official update (source):
.NET 5 is the next major release of .NET Core following 3.1. We named this new release .NET 5 instead of .NET Core 4 for two reasons:
We skipped version numbers 4.x to avoid confusion with .NET Framework 4.x.
We dropped "Core" from the name to emphasize that this is the main implementation of .NET going forward. .NET 5 supports more types of apps and more platforms than .NET Core or .NET Framework.
ASP.NET Core 5.0 is based on .NET 5 but retains the name "Core" to avoid confusing it with ASP.NET MVC 5. Likewise, Entity Framework Core 5.0 retains the name "Core" to avoid confusing it with Entity Framework 5 and 6.
.NET Core is the next evolution of the .NET Framework, that allows Microsoft technology to be hosted on other OS platforms, rather than Windows.
ASP.NET is the web framework provided by Microsoft for building:
server-side rendered web pages/websites
server-side components for SPAs
MVC-fashion apps
web services/web APIs/microservices
ASP.NET runs only on Windows platforms.
Since .NET Core was created to provide the capability of running Microsoft tech on top of Linux/macOS, it implies that ASP.NET Core is the evolution of ASP.NET in the direction of multi-platform support.
In conclusion:
ASP.NET Core runs on both .NET Core and .NET 5.0, on top of multiple OS platforms: Windows, Linux & macOS.
ASP.NET 4.x (ASP.NET/ASP.NET MVC) runs on the .NET Framework only, on top of Windows OS.

ASP.NET Core self-contained exe

I want my ASP.NET Core Web API to run as a self-contained exe within the .NET framework and not .NET Core Framework. Is that possible? Thanks!
EDIT:
If I add "net451": {} to my frameworks section in project.json,
I get the following exception:
Failed to make the following project runnable: myProject (.NETCoreApp,Version=v1.0) reason: Expected coreclr library not found in package graph. Please try running dotnet restore again.
You can't create a self-contained app which targets .NET Framework >=4.5, because the full .NET Framework isn't modular and its not possible to have more than one version of it installed. Newer versions basically always replace the previous one.
Self-contained apps were one main motivation for .NET Core (together with portability)
You ALWAYS have to install .NET >=4.5 before your app can run. self-contained apps only work with .NET Core because .NET core libraries can be pulled through nuget package.
For .NET 4.6 you can only create portable apps, which is the default mode.