5. Framework for Cross Platform Development
.NET Core is invented for Cloud Development but…
It runs on:
Win8, Win10 (all windows devices=> UWP + system32)
Linux, Mac-OS and ...
6. Application Types in .NET Core
Framework Dependent Application
Common .NET application type
It requires preinstalled .NET framework to run
Small footLprint
Running of multiple applications on the same box might be
difficult.
Self-Contained application
Precompiled for runtime
Includes runtime assemblies as a part of application
Does not need preinstalled framework
Big footprint.
Libraries
8. Global.json
Defines the SDK-s to be used
in solution (projects)
SDK is installed in:
C:Program Filesdotnetsdk
9. Project.json
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"netcorelib": "1.0.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
Dependencies
of application
Target
Framework
Moniker
This means that
application depends on
installed framework
(platform)
10. Build and Deploy…
Restores (downloads) nugget packages:
C:AppFolder>dotnet restore
Build application:
C:AppFolder>dotnet build
Feed:
Restoring packages for C:UsersddobricUwpAppproject.json...
GET https://api.nuget.org/v3-flatcontainer/system.runtime.windowsruntime/index.json
OK https://api.nuget.org/v3-flatcontainer/system.runtime.windowsruntime/index.json 463ms
GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/system.runtime.windowsruntime/index.js
OK https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/system.runtime.windowsruntime/index.jso
GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/system.runtime.windowsruntime/4.0.11-r
23925/system.runtime.windowsruntime.4.0.11-rc2-23925.nupkg
OK https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/system.runtime.windowsruntime/4.0.11-rc
23925/system.runtime.windowsruntime.4.0.11-rc2-23925.nupkg 385ms
11. Running application
Run application:
C:AppFolder>dotnet run
NOTE: Your
application is a DLL
and NOT an EXE!!!
NOTE: All framework
assemblies are loaded
from installation path
12. Self Contained Applications
Precompiled for specific runtime
win10-x64
osx.10.10-x64
ubuntu.14.04-x64
Includes runtime assemblies as a part of application
Does not need preinstalled framework
Big footprint.
Deployment is two-step process
Build Executable shim
Publish with runtime
13. Self-Contained Applications
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
// "type": "platform"
},
"netcorelib": "1.0.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
},
"runtimes": {
"win10-x64": {},
"osx.10.10-x64": {},
"ubuntu.14.04-x64": {}
}
Remove this to
activate build of
executable.
Add wanted
runtimes. Or you get
an error.
Failed to make the following project runnable:
netcoresample (.NETCoreApp,Version=v1.0) reason: Expected
coreclr library not found in package graph. Please try
running dotnet restore again.
16. Step I: Build executable shim
Build application:
C:AppFolder>dotnet build
Native shim code.
You application is still
here in DLL
When you run this it is will
load framework assemblies
from installation folder. It is
still not self-contained
application
21. How to build NUGET?
Create NUGET for library:
C:AppFolder>dotnet pack
Command output is
NUGET package
Example:
If library is 1.5 then .NET application must
be build with .NET 4.6.2 or higher.
22. .NET reference to .NET Core
Add NUGET reference to library from your .NET
(Desktop) application.
Checks specified standard
If you add direct reference standard is NOT checked.
23. UWP Reference to .NET Core
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
Before you add reference to .NET
Core Nuget Package your UWP app
must have reference to v5.5.2 or
higher.
With this TFM we know, that
this project.json is an
Universal Application
Platform app.
26. Ankete
Popunite ankete i osvojite vrijedne
nagrade!
Ankete su dostupne na:
a) Mobilnim uređajima (Android, Apple, Windows)
b) Web-u http://www.mobilityday.com
PIN za pristup se nalazi na poleđini akreditacije i u vašem
on-line profilu.