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

-戻る
--[[.NET config]]
--[[.NETのクロスプラットフォーム対応]]
---[[.NET Coreへの移行]]
---[[.NET Standardへの移行]]

* 目次 [#gf845f41]
#contents

*概要 [#lb32d1b6]
[[.NET Core]]では、~
[[app.config、web.config>.NET config]]の一部が、~
appsettings.jsonに変更されている。

-app.configのappSettings SectionをJSON化したもの。

-環境毎に設定を切り替えることができる。
--appsettings.Production.json~
ASPNETCORE_ENVIRONMENT ≠ Development
--appSettings.Development.json~
ASPNETCORE_ENVIRONMENT = Development

-[[.NET config]]にあった、*.configの、
--Element、Collection、Section自体は無くなっているので、~
---ConfigurationElement
---ConfigurationElementCollection
---ConfigurationSection
--自身で設定ファイル(appsettings.json)等の
---フォーマット定義
---Startup.cs(vb)実装

>が必要になる。

-一部、例外的に、[[.NET Core]]を[[IIS]]でホストする場合、~
system.webServer Section Groupに[[IIS]]や[[.NET Core]]に~
関する設定をするために、[[web.config>.NET config#u3d1af27]]を使用するケースがある。

--参考~
ASP.NET Core アプリケーションでも~
web.config をカスタマイズしたい - しばやん雑記~
https://blog.shibayan.jp/entry/20190604/1559616472

*詳細 [#x6f87fd0]
以下の様に、APIが変更になっている。

**System.Configuration.ConfigurationManager [#qcd853ca]
-NuGetパッケージにあるが使えない(詳細不明)。
-なので、[[Microsoft.Extensions.Configuration>#lc101ede]]を使用する。

**Microsoft.Extensions.Configuration [#lc101ede]
以下の情報を元にマイグレーションする必要がある。

**[[ASP.NET Core における DI]] [#sd513d97]

**[[ASP.NET Coreのデータ保護]] [#o1623943]
[[machine.config、machineKeyの後継>ASP.NETの状態管理方式#v0f39ab2]]

**[[ASP.NET Core における DI]] [#sd513d97]
**[[ASP.NET CoreのSession利用方法]] [#ve4cf0ad]

*参考 [#a5e6cabc]
-ASP.NET Coreの環境を切り替える方法 - athome-developer’s blog~
http://dblog.athome.co.jp/entry/2016/08/03/113000

**Qiita [#i9d87c4e]
-Visual Studio 2017 による ASP.NET Core MVC 開発~
https://qiita.com/hiromasa-masuda/items/5b9ff175aac3d1ef6ca6
-ASP.NET Core MVC における構成ファイル appsettings.json からの値取得~
https://qiita.com/hiromasa-masuda/items/d7e33b20d3eedee771f4

**microsoft.com [#q0bbab1a]
-ASP.NET Core の構成 | Microsoft Docs~
https://docs.microsoft.com/ja-jp/aspnet/core/fundamentals/configuration/index
-Essential .NET - .NET Core における構成~
https://msdn.microsoft.com/ja-jp/magazine/mt632279.aspx

**stackoverflow.com [#c5306eff]
-ASP.NET Core configuration for .NET Core console application - Stack Overflow~
https://stackoverflow.com/questions/38114761/asp-net-core-configuration-for-net-core-console-application
-c# - How to SetBasePath in ConfigurationBuilder in Core 2.0 - Stack Overflow~
https://stackoverflow.com/questions/46843367/how-to-setbasepath-in-configurationbuilder-in-core-2-0

----
Tags: [[:.NET開発]], [[:.NET Core]], [[:移行]]

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS