「.NET Core」の版間の差分
ナビゲーションに移動
検索に移動
| 72行目: | 72行目: | ||
*初期化時に 以下を実行 | *初期化時に 以下を実行 | ||
** System.Text.Encoding.RegisterPro[[vi]]der(System.Text.CodePagesEncodingPro[[vi]]der.Instance); | ** System.Text.Encoding.RegisterPro[[vi]]der(System.Text.CodePagesEncodingPro[[vi]]der.Instance); | ||
| + | ==Console== | ||
| + | ===設定ファイル=== | ||
| + | <pre> | ||
| + | dotnet add package Microsoft.Extensions.Configuration.Json --version 5.0.0 | ||
| + | </pre> | ||
| + | <pre> | ||
| + | using System; | ||
| + | using System.IO; | ||
| + | using Microsoft.Extensions.Configuration; | ||
| + | |||
| + | namespace docweb_bat | ||
| + | { | ||
| + | public class Program | ||
| + | { | ||
| + | static void Main(string[] args) | ||
| + | { | ||
| + | Console.WriteLine("Hello World!"); | ||
| + | |||
| + | IConfiguration configuration = new ConfigurationBuilder() | ||
| + | .SetBasePath(Directory.GetCurrentDirectory()) | ||
| + | .AddJsonFile("appsettings.json", true, true) | ||
| + | .Build(); | ||
| + | |||
| + | IConfigurationSection section = configuration.GetSection("DocumentWebDatabaseSettings"); | ||
| + | string str = section["DocumentWebCollectionName"]; | ||
| + | Console.WriteLine(str); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
2021年7月3日 (土) 04:39時点における版
| ASP.NET Core | Xamarin |
目次
.NET Core
.NET Core
- 最新の .NET 実装です。オープン ソースで、複数の OS 向けに利用できます。
- .NET Core により、クロスプラットフォーム コンソール アプリケーション、ASP.NET Core Web アプリケーション、およびクラウド サービスをビルドできます。
.NET Standard
- すべての .NET 実装が実装する必要のある基本 API のセットです。
- この API を基本クラス ライブラリ (BCL) と呼びます。
- .NET Standard をターゲットにすることで、どの .NET 実装やどの OS で実行されても、すべての .NET アプリケーションが共有できるライブラリをビルドできます。
.NET API ブラウザ
.NET ソースブラウザ
インストール
ダウンロード
Mac
CLIコマンド
SDKコマンド
| コマンド | 内容 |
|---|---|
| dotnet --info | .NET Core 情報の表示 |
プロジェクトレンプレート
dotnet new
$ dotnet new web
exe を出力
| デプロイ方法の名称 | 略称 | 実行方法 |
|---|---|---|
| Framework-dependent deployments | FDD | コマンドで dotnet hoge.dll として実行する |
| Self-contained deployments | SCD | 実行ファイルを直接実行する |
日本語コーデック
- NuGet で System.Text.Encoding.CodePages を追加
- 初期化時に 以下を実行
Console
設定ファイル
dotnet add package Microsoft.Extensions.Configuration.Json --version 5.0.0
using System;
using System.IO;
using Microsoft.Extensions.Configuration;
namespace docweb_bat
{
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
IConfiguration configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", true, true)
.Build();
IConfigurationSection section = configuration.GetSection("DocumentWebDatabaseSettings");
string str = section["DocumentWebCollectionName"];
Console.WriteLine(str);
}
}
}
© 2006 矢木浩人