Reputation: 437
I need to update a new .NET app and I think it was mentioned that it was .NET Core. How can I examine the solution properties to determine if it is in fact a "core" app?
The web project has a System.Core reference but I googled this and it seems that System.Core.dll has been a part of the .NET framework since at least .NET f/w 3.5.
The app has a package.json file but the existence of that file in a sln does not necessarily guarantee that the app is a .NET core app. I've also read that a .NET core app can run on different .NET framework versions.
So how can I determine if a .NET app is indeed a "Core" app? In other words, what makes a Core app a Core app?
Upvotes: 39
Views: 31860
Reputation: 64131
In VS2017 .NET Core projects use the .csproj structure again.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreappx.y</TargetFramework>
</PropertyGroup>
or
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandardx.y</TargetFramework>
</PropertyGroup>
There are some indicators to it.
The existence project.json
suggest it's one of the newer project forms (be aware though that project.json
will go away with .NET Core/.NET Core Tools for VS with Version 1.1).
Inside it, you'll have a frameworks section, like
"frameworks": {
"net45": {
"frameworkAssemblies": {
"System.Runtime.Serialization": "4.0.0.0"
}
},
"netstandard1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
}
},
"netstandard1.3": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"System.Runtime.Serialization.Formatters": "4.0.0-rc3-24212-01"
}
}
}
In case of applications (ASP.NET Core Web Project or new project.json based console applications), netstandard1.x
will be named netcoreapp1.0
.
If there is more than one entry, the application or library targets multiple platforms (and will build multiple binary files in separate folders).
Update
Of course I forgot another indicator. .NET Core application do reference Microsoft.NETCore.App
(either as "type": "platform"
for portable apps or without it for self-contained apps). netstandard1.x
(class libraries) do reference NETStandard.Library
.
.NET Core applications are based on System.Runtime
which is a part of .NET Framework 4.5 and newer and used for Windows (and Windows Phone) 8.0/8.1/10 applications, hence portable-net45+win81
packages are compatible with .NET Core too.
That being said, ASP.NET Core is a webstack which can run on both, full .NET Framework (4.5 or higher) and on .NET Core. So just having a ASP.NET Core application do not tell much about the platform it aims.
Upvotes: 11
Reputation: 1109
It is quite easy to determine Asp.net Core application.
There are some identifiers to it. There are few file in a project that helps to determine Core Project
Files like
Inside project.json, it include
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
Here by dependencies
one can determine about the type of project..NET Core application do reference Microsoft.NETCore.App (either as "type": "platform" for portable apps or without it for self-contained apps).
Asp.net Core Application are platform independent, So a ASP.NET Core application do not express much about the platform .
Upvotes: 2