윈도우 앱개발을 향하여

블로그 이미지
윈도우 10 스토어에 앱을 개발해 올리는 것을 목표로 하고 있습니다. 비전공자가 독학으로 시도하는 일이어서 얼마나 걸릴지 모르겠지만... 아무튼 목표는 그렇습니다!!
by 코딩하는 경제학도
  • Total hit
  • Today hit
  • Yesterday hit

Copyright

이 모든 내용은 pluralsight에 있는 Barry Luijbregts가 올린 The .NET Ecosystem: The Big Picture이라는 강의를 듣고 정리한 것입니다(https://app.pluralsight.com/library/courses/dotnet-ecosystem-big-picture/table-of-contents). Barry Luijbregts 원작자께 블로그 게시 허가도 받았습니다.



.Net development platform

includes Runtimes, .Net APIs, Compilers, languages and runtime component




1. Runtimes

런타임들(.NET Framework, .NET Core, Mono)은 모두 application과 library를 만들기위한 frameworks를 포함한다.


1-1 .NET Framework (프레임워크라고 되어있으나 실상은 런타임이고 플랫폼이다.)



Workloads (application type)

 - Console application

 - Windows communication Foundation (old web service communication)

 - Windows Workflow Foundation (Automate business processes)

 - Windows Presentation Foundation (Windows desktop application with potentially complex UIs)

 - Windows Forms ((Windows desktop application with simple UIs)

 - ASP.NET (Web applications)

     - (ASP.NET) Forms, MVC, Web API applications

 - Azure (WebJobs, Cloud Services)

some of them uses specific Windows APIs



.NET Framework provides a lot of functionality through its Class Library

(Classes, interfaces and value types... like string and collections)

.NET Framework Class Library is sometimes called as the Base Class Library. It contains specific functionality for windows platform, like classes to interact with the file system.




CLR = a thing that is part of the common infrastructure of the languages and build tools that all runtimes have.

 - Run code(Compilation mechanism like JIT compilation)

 - Garbage Collection(runtime helper mechanism)

 - C#, VB.NET, F# codes are run and managed by CLR

(CLR also manages communication between managed code and unmanaged code, like when calls API in the windows platform)


특징 : Windows centric (윈도우 전용 API들을 사용하기 때문)

.NET Framework only runs on the Windows platform(Windows Client version like Windows10, Windows Server versions like Windows server 2016)


.NET Framework의 1,2,4 버전을 컴퓨터에 각자 설치가능하고 1버전을 사용하는 application이나 4버전을 사용하는 application이 있을 수 있다. 그러나 4.7 버전을 설치하면 기존의 4.5버전은 사라진다. (즉 메이저 버전을 단위로 끊어진다. == not true side by side) 

- Major version = new CLR (ex) 3.5 -> 4

- Minor version = new library   (ex) 4.5.2 -> 4.6

- Revision = bug fixes (ex) 4.6 -> 4.6.2


.NET Framework는 C:\Windows\Microsoft.NET\Framework에 설치되어있다.




1-2 .NET Core (runtime)

open source(https://github.com/dotnet/core)


Workloads (application type)

 - Console application

 - ASP.NETCore

     - MVC, API

 - UWP (Universal Windows Platform)


.Net Core Class Library contains Classes like collections, file I/O, XML, and async. It's a subset of .NET Framework library to be more streamlined and lightweight. Basis of application to be small as it can be and additional component can be pulled in through Nuget


CoreCLR = part of the common infrastructure, It is different with .NET Framework CLR, CoreCLR is more lightweight and geared towards running code cross-platform and cross-architecture(it runs on x84, x64 and ARM CPU).

 - Assembly loading, Garbage Collection, C#, F#, VB.NET


App Host = usually .NET.exe (allow .NET Core to run on multiple platforms)

This launches .NET Core apps by hosting the CLR and libraries.


Windows Client, Windows Server, Windows IOT (like Raspberry Pi)

Linux (all sort of Linux distributions like Red Hat, Ubuntu, Tizen)

FreeBSD (UNIX like OS)

Mac OS X


.NET Core를 설치하면 선택한 버전의 application host(dotnet.exe)와 CoreCLR, library를 사용할 수 있게 된다. Application들은 원하는 버전의 .NET Core를 사용가능하며 심지어 .NET Core를 기기에 설치하지 않고 application이 자체적으로 필요한 .NET Core를 가지고 있을 수도 있다(self contained application). 보통 컴퓨터에는 C:\Program Files\dotnet에 설치되어있고, shared폴더에 버전들이 있다(각 버전들은 App Host인 dotnet.exe와 class library를 구성하는 많은 API들을 포함하고있다).


.NET Core 프로젝트를 생성해 프로그램을 만든뒤 솔루션을 우클릭하여 publish할 수 있다. dotnet.exe로 실행가능한 프로그램이 된다. self-contained application을 만들기 위해서는 csproj파일에 RuntimeIdentifier를 지정해주어야한다(ex win10-x64;osx.10.12-x64   윈도우10과 맥에서 실행가능하다. 세팅을 통해 윈10과 맥 버전을 따로 다른 폴더에 지정해 publish한다). 그리고 publish하면 library와 dll 그리고 실행가능한 exe까지 함께 만들어진다.




1-3 Mono (runtime) for Xamrin

Mono runtime은 .NET Framework CLR의 cross-platform을 지원한다. open source (http://github.com/mono/mono)

이 글에서는 Mono for Xamrin만 소개한다.



Workloads (type of application)

 - Apple IOS application

 - Apple Mac OS X application

 - Android applications

 - etc


All application workloads packages their application as self-contained application.


Xamarin Class Library is a subset of .NET Framework Class Library


Mono Runtime은 .NET Framework와 거의 동일한 common infrastructure를 가진다(Garbage Collector, JIT). 그러나 Mono Runtime은 C#만 작동하며 AOT(ahead of time compiler)을 추가로 지원한다.    



특징 : Cross platform (This is used to build and run native mobile application across mobile platforms.)

Specific API for IOS, Android, Xamarin.Mac






- 3개의 Runtime 비교




2. .Net Standard Library (purpose == share code between runtimes)

Set of .NET APIs formal specifications that describes APIs and what they do, Not a physical thing to download or install.

Evolution of Portable Class Library(PCL), .NET Standard replace PCL

(ps. PCL은 프로젝트간에 코드를 공유할 수 있는 다른 방법을 제공한다.)

 

All three runtimes implements .Net Standard Library

.Net Standard Library is a specification of .Net APIs that have implementations for each runtime.

때문에 다른 runtime에서 만들어진 코드가 다른 runtime에서도 실행가능하다.

(실전 : .NET Standard Library project를 생성해서 다른 runtime project에서 사용가능하다.)


Specific Runtime versions implements specific versions of .NET Standard, thereby implementing a specific set of APIs. 

(ex. .NET Framework 4.5 implements .NET Standard <= 1.1)


.NET Standard versioning

.NET Standard의 각 버전은 이전 버전의 API들을 포함한다.

( => higher version contains more API, lower version are supported by more platforms, so target the lowest version as possible)

(버전별 API검색 : http://docs.microsoft.com/en-us/dotnet/api)

(VS marketplace에 있는 .NET Portability Analyzer로 현재 프로젝트가 어떤 .NET Standard version과 매칭하는지 확인할 수 있다.)

There is no breaking changes between versions.

Once shipped, versions are frozen



+ Shared project template in VS == just links between files and projects, act as file-sharing mechanism between project 

do not result in assemblies when it built, do not provide APIs

(in compiler's view there is no shared project, shared project is contained inside of other project which referencing it. VS specific functionality)


3. Common Infrastructure


Build Tools (compiler like Roslyn, CLR, CoreCLR...)

Languages (C#, F#, VB.NET...)

Runtime Components (Garbage Collection, JIT...)


 - The .Net Framework Toolchain

(The purpose of the toolchain is to turn code into a running application)


MSBuild(build engine provided by MS. sln, .csproj, vbproj...) is a linking pin. MSBuild는 C#, VB.NET code는 Roslyn(.NET Compiler Platform)을, F# code에게는 F# Compiler를 호출한다. 결과는 exe, dll같은 IL이다. Intermediate Language(IL)은 CLR과 같은 runtime에 의해 해석된다.


Common Language Runtime(CLR)은 JIT(just-in-time) compiler를 가지고 있으며, 이 컴파일러로 IL을 해당 OS가 이해할 수 있는 native code로 컴파일한다.

CLR also acts as a host for running the application. Native code lives in memory and is managed by the CLR. It has tools for that like the garbage collector.


이 모든 과정을 개발자가 직접 할 수도 있으나 대부분의 경우 이런 일들은 VS와 같은 도구(MSBuild를 실행하는)가 해결한다.



- The .NET Core Toolchain

MSBuild는 .NET Core에서도 사용되며 IL이 나오기까지의 과정은 .NET Framework와 동일하다.


Core Common Language Runtime(CoreCLR)이 IL을 사용한다. CoreCLR은 .NET Framework CLR과 다르다. 가장 큰 차이점은 CoreCLR은 multiple platform(Mac OS나 Linux 등)에서 실행가능하다는 점이다. CoreCLR도 JIT compiler를 포함하고 있으며 IL을 Window, Mac OS, Linux등의 OS가 사용가능한 Native code로 컴파일한다. 이것은 ASP.NET Core나 콘솔 application의 경우이고 UWP는 조금 다른 경로로 Native code를 생성한다.


UWP app is compiled ahead of time with an ahead-of-time compiler(AOT compiler). 이런 방식을 .NET Native라 부른다.

AOT compiler compiles IL code into native code, but it produce this code as a deployable package instead of compiling the code on demand at runtime. This provide performance benefit.


Just like in the .NET Framework native code is run by the CoreCLR which provide capability like garbage collection.


그러나 .NET Framework CLR과 달리 CoreCLR과 Native Code는 application host process에 의해 load되고 kicked off된다. This process(dotnet.exe) hosts the CoreCLR and makes it run native code. 



- The Mono for Xamrin Toolchain

MSBuild가 조정자로써 동일하게 사용되나 앞전 2개와 달리 C#으로 작성된 프로젝트와 코드만 지원한다. (.sln, csproj)


C# code for Android compiled to IL by Xamarin Compiler. Then Mono Runtime's JIT compiler compiles it to Native code(specific for that android device on demand at runtime). 또한 Mono Runtime은 garbage collection과 같은 runtime service를 제공한다.


C# code for iOS의 경우 Xamarin Compiler가 모든 코드를 C# compiler나 AOT compiler를 이용해 native code로 precompile한다. This is special process that produces a package specifically for iOS containing its native code, which is ARM assembly language. iOS understand this and can run it.





- Summary of Toolchain





4. What to use When? (생략)


Copyright

이 모든 내용은 pluralsight에 있는 Barry Luijbregts라는 분이 올린 The .NET Ecosystem: The Big Picture이라는 강의를 듣고 정리한 것입니다. (https://app.pluralsight.com/library/courses/dotnet-ecosystem-big-picture/table-of-contents)(https://www.azurebarry.com/dot-net-ecosystem-explained) 강의에선 더 자세한 설명과 Demo를 포함하고 있으며, 마지막 What to use When?에 대한 내용 정리는 생략하겠습니다. Pluralsight에서 확인하세요. Microsoft 계정으로 한달간 무료로 Pluralsight의 수많은 강의를 시청하실 수도 있습니다.

AND

ARTICLE CATEGORY

분류 전체보기 (56)
Programming (45)
MSDN (4)
개발노트 (2)
reference (5)

RECENT ARTICLE

RECENT COMMENT

CALENDAR

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

ARCHIVE