Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to determine if a .net app is a "core" app?

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?

like image 976
user7066345 Avatar asked Nov 09 '16 02:11

user7066345


People also ask

How do I know if an application is .NET Core?

NET Core is installed on Windows is: Press Windows + R. Type cmd. On the command prompt, type dotnet --version.

How can you tell if a code is written for .NET or .NET Core?

Microsoft has a Portability Analyzer that will tell you if your code will run on various platforms and what kind of changes are required, but the only way I know to tell what platform particular code was written for is to check the project properties or makefile.

What are .NET Core apps?

ASP.NET Core is a cross-platform, high-performance, open-source framework for building modern, cloud-enabled, Internet-connected apps. With ASP.NET Core, you can: Build web apps and services, Internet of Things (IoT) apps, and mobile backends. Use your favorite development tools on Windows, macOS, and Linux.


1 Answers

Updated for .NET Core >= 2.x and/or VS2017

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> 

Old Answer for .NET Core 1.x and VS2015

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.

like image 195
Tseng Avatar answered Sep 20 '22 05:09

Tseng