尝试从测试程序集安装所有独立的安装程序时,总是会抛出
"`{"Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration1<!0> Castle.MicroKernel.Registration.ComponentRegistration1.DependsOn(Castle.MicroKernel.Registration.Dependency)'."}`" 尽管代码可以很好地从控制台应用程序/Windsow服务运行,而且两个项目的引用是相同的:
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")))注意:请注意,当在主应用程序下运行时,所有安装类都工作得很好,这纯粹是运行单元测试时的情况。
谢谢你的帮助。
发布于 2013-01-16 12:16:36
看起来你有一个旧版本的Windsor,在部署时会覆盖新版本
https://stackoverflow.com/questions/13969690
复制相似问题