「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。

-[[戻る>.NETのクロスプラットフォーム対応]]

* 目次 [#y0623161]
#contents

*概要 [#ie8e5050]
.NET Standardは
-バージョンごとに「線形的」な管理が行われていて、
-新しいバージョンの.NET Standardは古いバージョンで定められている全てのAPIセットを含むようになっている。
-従来のPCLのようにプロファイル(プラットフォーム)ごとに使用できるAPIが決定するのではなく、~
.NET Standardの特定バージョンをサポートしている環境であれば、その全てで.NET Standardを利用できる。
-.NET Standard は、次世代のポータブル クラス ライブラリ (PCL)であるとのこと。

∴ クロスプラットフォームで実行可能なライブラリを作成する手段として、従来のPCLを置き換える。
-.NET Standard は、
--バージョンごとに「線形的」な管理が行われていて、
--新しいバージョンの .NET Standard は古いバージョンで定められている全てのAPIセットを含むようになっている。
--従来のPCLのようにプロファイル(プラットフォーム)ごとに使用できるAPIが決定するのではなく、~
.NET Standard の特定バージョンをサポートしている環境であれば、その全てで .NET Standard を利用できる。

>∴ クロスプラットフォームで実行可能なライブラリを作成する手段として、従来のPCLを置き換える。

*文脈上の意味 [#he977648]
**仕様としての .NET Standard [#u42e76a1]
***概要 [#sa56a2ad]
-CLI の実装系が持つ べき API のセットを定義
-仕様なので実装系はその API を実装しない、または実装できないことがある。

***参考 [#z4b91031]
-Microsoft Docs
--.NET Standard~
https://docs.microsoft.com/en-us/dotnet/articles/standard/library

-dotnet/standard
--standard/versions.md at master~
https://github.com/dotnet/standard/blob/master/docs/versions.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.0.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.0_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.1.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.1_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.2.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.2_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.3.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.3_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.4.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.4_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.5.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.5_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.6.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.6_ref.md
---https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md~
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0_ref.md

***仕様としての .NET Standard 2.0 [#x2425538]
-.NET Framework のエコシステムは既に想定以上に広がっていたため、
--Xamarin もベースとしている Mono が .NET Framework 互換

-「[[.NET Core]] の普及に伴い、自然と新しい API (≒ [[.NET Core]])に移行。」とはならなかった。

--.NET Standard の範囲を広げ、従来の .NET Framework の API をより多くサポート。
--既存の .NET Framework 向けのライブラリを [[.NET Core]](など)でそのまま動作できるようにする。

**Target Platform Moniker (TPM) としての .NET Standard [#ka7d0a1b]
***Target Platform Moniker (TPM)とは、 [#h6054b3d]
-NuGet での対象プラットフォームを表す識別子
-PCL(のプロファイル)の後継

***TPMで、.NET Standardのバージョンを指定した場合 [#t0b263b4]
当該.NET Standardのバージョンで
-定義される標準ライブラリのみを使用して動作する。
-サポートされるプラットフォーム用のアプリケーションから使用できる。

***TPM としての .NET Standard 2.0 [#idbed5d3]
-netstandard2.0 になる

-追加されるライブラリ群
--BinaryFormatterと、それに伴うインターフェイスやカスタム属性。
--ADO.NET(DataSet, Data Provider, e.g.:DbConnection.GetSchema)のサポート。

--以下のライブラリを追加
---mscorlib
---System
---System.Core
---System.Numerics
---System.Data
---System.IO.Compression
---System.IO.Compression.FileSystem
---System.Xml
---System.Xml.Linq
---System.Web
---System.Net.Http
---System.Runtime.Serialization
---System.Drawing
---System.ComponentModel.Composition

**NuGet パッケージとしての .NET Standard [#i0164a78]
-NuGet パッケージとしての .NET Standardパッケージ([[NetStandard.Library>https://www.nuget.org/packages/NETStandard.Library/]])
-[TypeForwardedTo]による実行時の型転送用ファサードアセンブリ

***NuGet パッケージとしての .NET Standard 2.0 [#k569f39a]
netstandard.dll という実行時の型転送用ファサードアセンブリになる予定

*バージョン [#e7839104]
**.NET Standard 1.x [#yb8b14a6]
-TPM = netstandard1.x の小さなバージョンの方が多くの環境で動作する模様。

-stripe-dotnetなどユーザが多いライブラリは、より多くのユーザを
サポートするため、2.xにアップグレードする予定はないもよう。
--Start targeting .NET Standard 2.0 · Issue #992 · stripe/stripe-dotnet~
https://github.com/stripe/stripe-dotnet/issues/992#issuecomment-336814135

**.NET Standard 2.x [#p7ead542]
TPM = netstandard2.x 

***リリース [#kb9ff127]
-.NET Standard 2.0 のリリースは「Q3 2017」とあるので、~
今年の第三四半期 (2017/7~9) には出るようです。~
https://github.com/dotnet/core/blob/master/roadmap.md#ship-dates 

-.NET Core 2.0 と .NET Standard 2.0 がリリースされたよ: C# プログラミング 再入門~
http://dotnetcsharptips.seesaa.net/article/452777200.html

-Announcing .NET Standard 2.0 | .NET Blog~
https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-net-standard-2-0/

***サポート [#b33c7cf6]
-Microsoftは、 大量のAPI追加と互換性レイヤー導入のため、バージョン番号を2.0に上げることにした。
--Standard 1.xへの破壊的変更は導入されず、1.6をベースにしている。
--.NET Standard 1.0の400%、.NET Standard 1.6の140% 増の32,000以上のAPIが含まれる。

--互換レイヤがあるらしい。
---多くのNuGetパッケージは.NET Framework向けに作成されており、Standardと互換性を持たせるのはかなり難しい。~
---そこでMicrosoftは、たとえ.NET StandardやPCL向けにビルドされていなくても、~
ライブラリを複数のプラットフォームで動かせるようにする薄いレイヤーを追加した。
---この互換性機能のおかげで、NuGetパッケージの70%ほどはStandardと互換性がある。



-以下によってサポートされる。~
.NET 4.6.0 (以前) や、Windows Phone 8、Windows 8.x(ストアアプリ)を~
サポートする必要がなければ、.NET Standard 2.0の方が多くの環境で動作する模様。

--.NET Standard | Microsoft Docs > .NET 実装のサポート~
https://docs.microsoft.com/ja-jp/dotnet/standard/net-standard#net-implementation-support

--上記以外
---Unity~
近い将来、ツールを最新バージョンに合わせる際、.NET Standardをサポートする予定。

***開発 [#z1acf213]
Visual Studio 2017 Update3をインストールした後に.NET Core SDKをインストールする。

-Visual Studio 2017 Update 2へUpdate3を適用する方法 - nuits.jp blog~
http://www.nuits.jp/entry/update-to-vs-2017-update-3
-.NET Standard 2.0対応クラスライブラリを作る - nuits.jp blog~
http://www.nuits.jp/entry/enable-net-standard-20-for-vs-2017-update-3
--.NET and C# | Get Started in 10 Minutes~
Install .NET and build your first app on Windows~
https://www.microsoft.com/net/core#windowscmd
---Download .NET Core SDK~
https://aka.ms/dotnet-sdk-2.0.0-win-gs-x64

すると、Visual Studio 2017のメニューから、

-新規作成 ---> プロジェクト
-.NET Standard ---> クラスライブラリ(.NET Standard)

と、ターゲットフレームワーク  :.NET Standard 2.0 のクラスライブラリを開発できる。

*参考 [#h5cc1e09]
**[[.NET Standardへの移行]] [#y00b3c57]

**microsoft.com [#v5ebfa9f]
-.NET Standard | Microsoft Docs~
https://docs.microsoft.com/ja-jp/dotnet/standard/net-standard
-.NET API Browser(netstandard-2.0) | Microsoft Docs~
https://docs.microsoft.com/en-us/dotnet/api/?view=netstandard-2.0

**infoq.com [#f9008114]
-.NET Standard 2.0とは何か~
https://www.infoq.com/jp/news/2016/12/dotnet-standard-20-goals
-.NET Standard 2.0が最終版に~
https://www.infoq.com/jp/news/2017/08/net-standard-2

**@IT [#o88242ff]
-特集:マイクロソフトテクノロジーの現在と未来:.NET Standardとは - @IT
--(1/3)~
http://www.atmarkit.co.jp/ait/articles/1707/28/news033.html
--(2/3)~
http://www.atmarkit.co.jp/ait/articles/1707/28/news033_2.html
--(2/3)~
http://www.atmarkit.co.jp/ait/articles/1707/28/news033_3.html

**Build Insider [#p9e2aef5]
-.NET Standardなライブラリプロジェクトを作成して参照する~
https://www.buildinsider.net/language/dotnetcore/05

**その他 [#h3fee029]
-主に技術日記: .NET Standard のおさらい~
http://yfakariya.blogspot.jp/2016/12/net-standard.html
--Net fringejp2016~
https://www.slideshare.net/yusukefujiwara731/net-fringejp2016

-.NET Standard とは何か? | Moonmile Solutions Blog~
http://www.moonmile.net/blog/archives/8218
-さいきんの.NETのこととかNuGetとかCoreとかよく分からないよねーって話 - Qiita~
http://qiita.com/acple@github/items/e80bef939583fc2b0e5e
-Xamarin(Formsもね)で.NET Standard 2.0なライブラリを利用する - nuits.jp blog~
http://www.nuits.jp/entry/xamarin-forms-with-netstandard-20

----
Tags: [[:.NET開発]], [[:.NET Core]], [[:.NET Standard]]


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS