Castle Windsor 3.1缺少方法异常。

4

尝试从测试程序集安装所有单独的安装程序时,会抛出一个错误:

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

尽管代码从控制台应用程序/Windows服务完美运行,而且两个项目的引用是相同的:

Castle.Core
Castle.Facilities.FactorySupport
Castle.Facilities.Logging
Castle.Facilities.QuartzIntegration
Castle.Services.Logging.NLogIntegration
Castle.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")))

注意:请注意,在运行单元测试时,所有安装类都可以在主应用程序下正常工作,这仅是情境案例。
感谢任何帮助。

有没有人以前遇到过这个问题?不幸的是,它正在阻碍我的开发。 - M05Pr1mty
你的测试项目中有Assembly.WindowsService的引用吗?你能否尝试一种不使用字符串的方法,而不是FromAssembly.Named? - Marwijn
@Marwijn 所有对 Windsor 和本地类库的引用都已经存在。这已经使用每个 FromAssmbly 方法进行了测试,结果相同,无论是使用魔术字符串还是其他方式。 - M05Pr1mty
1个回答

3

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


谢谢回复 - 我会再次检查这个。 - M05Pr1mty

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接