微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – Castle Windsor 3.1缺失方法例外

试图从测试组件安装我所有的单独安装程序一直在投掷

"`{"Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration1<!0> Castle.MicroKernel.Registration.ComponentRegistration1.DependsOn(Castle.MicroKernel.Registration.Dependency)'."}`"

尽管代码从Console应用程序/ Windsows服务完美运行,但两个项目的引用完全相同:

Castle.Core
Castle.Facilities.FactorySupport
Castle.Facilities.Logging
Castle.Facilities.QuartzIntegration
Castle.Services.Logging.NLogIntegration
Castle.Windsor

有没有人知道为什么测试组件如此调用windsor容器的构建:

this.Container = new WindsorContainer(new XmlInterpreter())
       .Install(FromAssembly.Named("Assembly.WindowsService",new CustomWindsorInstallerFactory()));

在引用“DependsOn”方法的任何代码上失败,例如:

container.Register(
    Component
         .For<ISftpRepository,ISftpFileStoreRepository,AbstractSftpFileStoreRepository>()
         .ImplementedBy<ConcreteSftpRepository>()
         .Properties(PropertyFilter.IgnoreAll)
         .DependsOn(
              Dependency.OnConfigValue("host",config.Host),

要么:

.ConfigureFor<QuartzJob>(
      x => 
      x.DependsOn(ServiceOverride.ForKey<IService>().Eq("intraService")))

注意:请注意所有安装类在主应用程序下运行时都能正常工作,这在运行单元测试时纯粹是一种情境.

谢谢你的帮助.

解决方法

看起来你有一个较旧版本的Windsor在部署时会覆盖新版本

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐