私のIOS/AndroidアプリのPCL部分に設定ファイルを置こうとしています。でPCLAppConfigを使用するXamarin Portable設定ファイル
ドキュメント:https://github.com/mrbrl/PCLAppConfig が示唆:
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
ConfigurationManager.AppSettings = new ConfigurationManager(assembly.GetManifestResourceStream("DemoApp.App.config")).GetAppSettings;
を私はのDemoAppが彼らのサンプルアプリケーションのアセンブリ名ですので、私が持っている期待:
PCLAppConfigを使用して、
/Users/greg/Projects/LYG/LYG/LYG.cs(122,122):
namespace LYG
{
public class App : Application
{
public App()
{
Assembly assembly = typeof(App).GetTypeInfo().Assembly;
ConfigurationManager.AppSettings = new ConfigurationManager(assembly.GetManifestResourceStream("LYG.App.config")).AppSettings;
}
...
}
}
は、私は以下のコンパイルエラーを取得エラーCS1061:型PCLAppConfig.ConfigurationManager' does not contain a definition for
GetAppSettings'と拡張子なしの方法GetAppSettings' of type
PCLAppConfig。 ConfigurationManager 'が見つかりました。アセンブリの参照がありませんか? (CS1061)(LYG)
これは私のpackages.configファイルです:私も括弧で試してみました
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="PCLAppConfig" version="0.3.1" targetFramework="portable45-net45+win8+wp8" />
<package id="PCLStorage" version="1.0.2" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.Forms" version="2.3.2.127" targetFramework="portable45-net45+win8+wp8" />
</packages>
:
ConfigurationManager.AppSettings = new ConfigurationManager(assembly.GetManifestResourceStream("LYG.App.config")).AppSettings();
はなぜGetAppSettingsを見つけることができないのですか?