I'am new to Castle and Castle.Windsor, so this is maybe a noob question.
I created an empty console .NET 4.0 application and added next packages through NuGet:
- Castle Windsor factory support facility 3.0 beta 1 (3.0.2001)
- Castle Windsor 3.0 beta 1 (3.0.2001)
- Castle Core 3.0 beta 1 (3.0.2001)
- Castle NHibernate facility (0.5.1.4000)
- Fluent NHibernate (1.3.0.717)
- NHibernate (3.2.0.4000)
- Iesi Collections (3.2.0.4000)
and wrote next code:
static void Main(string[] args)
{
IWindsorContainer container = new WindsorContainer();
container.AddFacility<AutoTxFacility>();
//container.AddFacility<NHibernateFacility>();
}
But I got an error:
GenericArguments[0], 'TService', on 'Castle.MicroKernel.Registration.RegistrationGroup`1[S]' violates the constraint of type parameter 'S'.
If rewrite code and uncomment second AddFacility line:
static void Main(string[] args)
{
IWindsorContainer container = new WindsorContainer();
//container.AddFacility<AutoTxFacility>();
container.AddFacility<NHibernateFacility>();
}
I got next error:
Could not load type 'Castle.Facilities.FactorySupport.FactorySupportFacility' from assembly 'Castle.Windsor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
I tried add container.AddFacility<Castle.Facilities.FactorySupport.FactorySupportFacility>();
line before first AddFacility but it not solve a problem.
In real application I got another error for same try and same libraries:
Could not load file or assembly 'Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
with next FusionLog:
=== Pre-bind state information ===
LOG: DisplayName = Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
(Fully-specified)
LOG: Appbase = file:///xxx.Test/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : Castle.Facilities.AutoTx, Version=3.0.202.2202, Culture=neutral, PublicKeyToken=407dd0808d44fbdc.
LOG: This bind starts in default load context.
LOG: Using application configuration file: xxx.Test\bin\Debug\xxx.Test.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
LOG: Attempting download of new URL file:///xxx.Test/bin/Debug/Castle.Windsor.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I don't understand what I doing wrong.