0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Prism 8 と DryIoc 5 は共存できない

Posted at

WPF+Prism アプリケーションを作るとき、DIコンテナーは UnityContainerかDryIoc の二択で(Autofac対応はずいぶん前に削除された)、nuget からは Prism.DryIoc パッケージを追加すればいいのだけれど、ロギングその他をDI経由で使う場合に 以下のようにすることとなる

class App{
        protected override IContainerExtension CreateContainerExtension()
        {
            var services = new ServiceCollection();
            services.AddLogging(loggingBuilder =>
            {
                loggingBuilder.ClearProviders();
                loggingBuilder.SetMinimumLevel(LogLevel.Trace);
                loggingBuilder.AddNLog();

            });

            var container = new DryIoc.Container(CreateContainerRules())
                       .WithDependencyInjectionAdapter(services);
            return new Prism.DryIoc.DryIocContainerExtension(container);
        }

}

これを実行すると以下のような例外が発生する。

System.MissingMethodException: 'Method not found: 'DryIoc.Rules DryIoc.Rules.WithoutFastExpressionCompiler()'.'

これは Prism.DryIoc 8 が DryIoc 4 をベースにしており、その DryIoc 5 から WithoutFastExpressionCompiler が削除されているから。

したがって 一旦 Prism.DryIoc 8 をインストールした後 DryIoc を 4 系列に更新する必要がある。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?