SlideShare ist ein Scribd-Unternehmen logo
1 von 57
16年專案資歷
4年顧問資歷
• 部落格 (Gelis 技術隨筆)
http://gelis-dotnet.blogspot.tw/
• FB 粉絲團(Gelis 的程式設計訓練營)
https://www.facebook.com/gelis.dev.learning/?ref=bookmarks
• FB 社團 (軟體開發之路)
https://www.facebook.com/groups/361804473860062/?ref=ts&fref=ts
集英信誠 - 資深.NET開發顧問
.NET Conf
什麼是 .NET Standard?
• .NET Standard
.net 程式庫 BCL (Base Class Library) 並取
代現有的可攜式類別庫 PCLs.
所以目標是希望開發人員不會因為這(Full .NET Framework
/.NET Core/Xamarin)三個平台就要改寫 .NET 程式碼
.NET BCL (Base Class Library) .NET
Standard
• 因此沒有良好系統(APIs)版本控制方法
• 不容易計算出各 Platform 交叉之處
• 若再有新平台出現,便不相容
• 不容易維護其 PlatForm 間相容的關係
Platform 3Platform 1
Platform 2
Platform 4
?
今天的 .NET —reusing code
今天的 .NET —reusing code
今天的 .NET —reusing code
.NET tomorrow
.NET Standard
BASE
LIBRARIES
.NET tomorrow
.NET Standard
.NET tomorrow
.NET Standard
容易
容易
容易
.NET Standard 2.0+
 支援更多的 APIs!  與 .NET Framework libraries 完全兼容
 .NET standard 2.0 的 APIs 數
量幾乎是 1.6 的一倍之多!
大部分的 APIs 仍舊與現有 .NET
Framework 完全相容
因為相容性的因素,您依舊可以
在其他平台上使用
Version #APIs Growth %
1.6 13,501 +1%
2.0 32,638 +142%
Target Usage on NuGet
.NET Framework 46,894
.NET Standard 1,886
PCL 4,501
~70%
+20K
• .NET Framework 4.6.1
• .NET Core 2.0 ↑
• Xamarin.Android 8.0
Primitives • Collections • Reflection • Interop • LinqCORE
Threads • Thread Pool • TasksTHREADING
Files • Compression • MMFIO
Sockets • Http • Mail • WebSocketsNETWORKING
BinaryFormatter • Data Contract • XMLSERIALIZATION
XLinq • XML Document • XPath • Schema • XSLXML
Abstractions • Provider Model • DataSetDATA
• 外圍的可以包含內圈所有項目
各自實現了一
部份的 .NET Standard 標準
• 也就是說,在目前的 .NET
Standard 2.0+ 中,您可以參考
1.6/1.3/1.0 的 DLLs
2.0+
1.6
1.3
1.0
.NET Standard 那『目標』的 .NET
Framework 版本是 4.6.1 以上?
2.x
4.6.2 4.7.x (只會提升)
Immo Landwerth 提供的 .NET Standard 互動式資料表
How does .NET Standard work?
NetStandard.Library
netstandard.dll
netstandard.dll
My Standard Library 2.x
.NET Standard Library .NET Framework LibraryPortable Class Library
.NET FRAMEWORK .NET CORE XAMARIN
Via Portability
Via Compatibility Shim
Legend
Application Type
Is able to reference
TYPE
FORWARDING
This happens when you build a .NET Standard-based Library
TYPE
FORWARDING
This happens when you load .NET Standard-based library
TYPE
FORWARDING
This happens when you build a .NET Standard-based library with platform-specific extensions
TYPE
FORWARDING
This happens when you load .NET Standard-based library with platform-specific extensions
EXCEPTION
TYPE
FORWARDING
什麼是 Type Forwarding?
這是什麼黑魔法?
而無須重新編譯
使用該組件的原應用程式
• 在需要尋找該型別的來源組件加入 TypeForwardAttribute:
• [assembly: TypeForwardToAttribute(typeof(ExampleClass))]
• 原本參照的程式碼中原本的 using 與使用部分都不需要修改
• 因為應用程式只需要與 netstandard.dll 耦合
• 其實就是 Proxy Pattern 樣式
• TypeForwardToAttribute 定義在:System.Runtime.CompilerService
• 使用命令列編譯 C# 時,使用 /reference 編譯器選項
«元件»
«元件»
Class1
TypeForwardToAttribute(typeof(Class1))
型別轉送
使用.NET Portability Analyzer
檢測現有程式碼不支援那些平台?
https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilit
yAnalyzer
https://github.com/Microsoft/dotnet-apiport/releases?id=42678
Lower Version
More Reach
Higher Version
More APIs
HTTP/HTTPS
Business Object
Business Object
Web Host
JSON Over
(Web API/SignalR)
ApiHostBase
ApiCore ServerComponent
fb.com/Study4.twfb.com/groups/216312591822635 Study4.TW
Q & A
謝謝大家!

Weitere ähnliche Inhalte

Was ist angesagt?

I os与android多平台开发心得
I os与android多平台开发心得I os与android多平台开发心得
I os与android多平台开发心得
drewz lin
 

Was ist angesagt? (20)

軟體開發之路甘苦談(Gelis)
軟體開發之路甘苦談(Gelis)軟體開發之路甘苦談(Gelis)
軟體開發之路甘苦談(Gelis)
 
團隊開發永遠的痛 談導入團隊開發的共同規範(Final)
團隊開發永遠的痛   談導入團隊開發的共同規範(Final)團隊開發永遠的痛   談導入團隊開發的共同規範(Final)
團隊開發永遠的痛 談導入團隊開發的共同規範(Final)
 
Asp.net mvc 基礎
Asp.net mvc 基礎Asp.net mvc 基礎
Asp.net mvc 基礎
 
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
 
如何培養架構性思考(談軟體架構師必經之路)
如何培養架構性思考(談軟體架構師必經之路)如何培養架構性思考(談軟體架構師必經之路)
如何培養架構性思考(談軟體架構師必經之路)
 
Windows App development for iOS, Android developer
Windows App development for iOS, Android developerWindows App development for iOS, Android developer
Windows App development for iOS, Android developer
 
2020 11-27 Taiwan DDD Conference
2020 11-27 Taiwan DDD Conference2020 11-27 Taiwan DDD Conference
2020 11-27 Taiwan DDD Conference
 
[DDD] 快快樂樂學DDD
[DDD] 快快樂樂學DDD[DDD] 快快樂樂學DDD
[DDD] 快快樂樂學DDD
 
前端编译平台
前端编译平台前端编译平台
前端编译平台
 
領域驅動設計
領域驅動設計領域驅動設計
領域驅動設計
 
ChatBot
ChatBotChatBot
ChatBot
 
領域驅動設計 (Domain Driven Design)
領域驅動設計 (Domain Driven Design)領域驅動設計 (Domain Driven Design)
領域驅動設計 (Domain Driven Design)
 
I os与android多平台开发心得
I os与android多平台开发心得I os与android多平台开发心得
I os与android多平台开发心得
 
工作坊簡介
工作坊簡介工作坊簡介
工作坊簡介
 
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練12015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1
 
DDD x Architecture
DDD x ArchitectureDDD x Architecture
DDD x Architecture
 
面對移動化App挑戰的架構設計
面對移動化App挑戰的架構設計面對移動化App挑戰的架構設計
面對移動化App挑戰的架構設計
 
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練32015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
 
前端工程化与工具链实践
前端工程化与工具链实践前端工程化与工具链实践
前端工程化与工具链实践
 
架構設計入門 twMVC#11
架構設計入門 twMVC#11架構設計入門 twMVC#11
架構設計入門 twMVC#11
 

Ähnlich wie 使用 .NET Standard 開發跨平台應用程式

使用Dsl改善软件设计
使用Dsl改善软件设计使用Dsl改善软件设计
使用Dsl改善软件设计
mingjin
 
石玉磊 Web rebuild
石玉磊 Web rebuild石玉磊 Web rebuild
石玉磊 Web rebuild
Webrebuild
 
白玉磊 Webrebuild
白玉磊 Webrebuild白玉磊 Webrebuild
白玉磊 Webrebuild
裕波 周
 
開放原始碼 Ch2.4 app - oss - db (ver 1.0)
開放原始碼 Ch2.4   app - oss - db (ver 1.0)開放原始碼 Ch2.4   app - oss - db (ver 1.0)
開放原始碼 Ch2.4 app - oss - db (ver 1.0)
My own sweet home!
 
Django敏捷开发 刘天斯
Django敏捷开发 刘天斯Django敏捷开发 刘天斯
Django敏捷开发 刘天斯
liuts
 

Ähnlich wie 使用 .NET Standard 開發跨平台應用程式 (20)

DEV305 - ASP.NET 5 開發攻略
DEV305 - ASP.NET 5 開發攻略DEV305 - ASP.NET 5 開發攻略
DEV305 - ASP.NET 5 開發攻略
 
.NET 7 家族新成員: Microsoft Orleans v7
.NET 7 家族新成員:Microsoft Orleans v7.NET 7 家族新成員:Microsoft Orleans v7
.NET 7 家族新成員: Microsoft Orleans v7
 
Asp.net core v1.0
Asp.net core v1.0Asp.net core v1.0
Asp.net core v1.0
 
Asp.net core v1.0
Asp.net core v1.0Asp.net core v1.0
Asp.net core v1.0
 
Langchain and Azure ML and Open AI
Langchain and Azure ML and Open AILangchain and Azure ML and Open AI
Langchain and Azure ML and Open AI
 
JIRA Live DEMO 2020 v17
JIRA Live DEMO 2020 v17JIRA Live DEMO 2020 v17
JIRA Live DEMO 2020 v17
 
基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发
 
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
 
Team Foundation Server
Team Foundation ServerTeam Foundation Server
Team Foundation Server
 
使用Dsl改善软件设计
使用Dsl改善软件设计使用Dsl改善软件设计
使用Dsl改善软件设计
 
石玉磊 Web rebuild
石玉磊 Web rebuild石玉磊 Web rebuild
石玉磊 Web rebuild
 
白玉磊 Webrebuild
白玉磊 Webrebuild白玉磊 Webrebuild
白玉磊 Webrebuild
 
Visual Studio 2017 新功能探索 (Study4.TW)
Visual Studio 2017 新功能探索 (Study4.TW)Visual Studio 2017 新功能探索 (Study4.TW)
Visual Studio 2017 新功能探索 (Study4.TW)
 
Artifacts management with CI and CD
Artifacts management with CI and CDArtifacts management with CI and CD
Artifacts management with CI and CD
 
4. Go 工程化实践-0124-v2.pdf
4. Go 工程化实践-0124-v2.pdf4. Go 工程化实践-0124-v2.pdf
4. Go 工程化实践-0124-v2.pdf
 
開放原始碼 Ch2.4 app - oss - db (ver 1.0)
開放原始碼 Ch2.4   app - oss - db (ver 1.0)開放原始碼 Ch2.4   app - oss - db (ver 1.0)
開放原始碼 Ch2.4 app - oss - db (ver 1.0)
 
Rest与面向资源的web开发
Rest与面向资源的web开发Rest与面向资源的web开发
Rest与面向资源的web开发
 
Django敏捷开发 刘天斯
Django敏捷开发 刘天斯Django敏捷开发 刘天斯
Django敏捷开发 刘天斯
 
.net framework from 1.0 -> 4.0
.net framework from 1.0 -> 4.0.net framework from 1.0 -> 4.0
.net framework from 1.0 -> 4.0
 
微服務架構 導入經驗分享 吳剛志 - Community Open Camp
微服務架構 導入經驗分享 吳剛志 - Community Open Camp微服務架構 導入經驗分享 吳剛志 - Community Open Camp
微服務架構 導入經驗分享 吳剛志 - Community Open Camp
 

Mehr von Gelis Wu

Mehr von Gelis Wu (18)

Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________
 
.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf
 
顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx
 
Blazor Component 開發實戰
Blazor Component 開發實戰Blazor Component 開發實戰
Blazor Component 開發實戰
 
一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南
 
Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展
 
客製化的 Web api 的框架設計
客製化的 Web api 的框架設計客製化的 Web api 的框架設計
客製化的 Web api 的框架設計
 
Asp.net identity 2.0
Asp.net identity 2.0Asp.net identity 2.0
Asp.net identity 2.0
 
Azure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solutionAzure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solution
 
活用 Application insight
活用 Application insight活用 Application insight
活用 Application insight
 
企業現代化網站架構
企業現代化網站架構企業現代化網站架構
企業現代化網站架構
 
Css java script 前端網頁設計概論(day2).pics
Css java script 前端網頁設計概論(day2).picsCss java script 前端網頁設計概論(day2).pics
Css java script 前端網頁設計概論(day2).pics
 
Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4
 
Css java script 前端網頁設計概論(day1)
Css java script 前端網頁設計概論(day1)Css java script 前端網頁設計概論(day1)
Css java script 前端網頁設計概論(day1)
 
C sharp物件導向 分層架構課程
C sharp物件導向   分層架構課程C sharp物件導向   分層架構課程
C sharp物件導向 分層架構課程
 
.Net framework 技術架構發展與 c# 6.0
.Net framework 技術架構發展與 c# 6.0.Net framework 技術架構發展與 c# 6.0
.Net framework 技術架構發展與 c# 6.0
 
使用 Release management 2013 進行自動化部署
使用 Release management 2013 進行自動化部署使用 Release management 2013 進行自動化部署
使用 Release management 2013 進行自動化部署
 
使用 Quartz
使用 Quartz使用 Quartz
使用 Quartz
 

使用 .NET Standard 開發跨平台應用程式

Hinweis der Redaktion

  1. Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different.
  2. Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different.
  3. Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different.
  4. Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different.
  5. Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different.
  6. Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different.