Castle Windsor's DictionaryAdapter - c#

I'm trying to upgrade one of our applications from Castle Windsor 2.1 to 2.5.
I've removed all of the Castle DLL's, and added the 2.5 version as downloaded from Castle's website:
Castle.Core.dll
Castle.Windsor.dll
Before doing the migration, I also had a reference on my project to:
Castle.Components.DictionaryAdapter.dll
However, according to Krzysztof Koźmic's post here, such reference is no longer necessary, since the DictionaryAdapter now comes bundled into Castle.Core.dll.
Upon removing it, I get errors all over the place saying:
Error 6 The type or namespace name 'DictionaryComponent' could not be
found (are you missing a using directive or an assembly
reference?)
and
Error 64 The type or namespace name 'DictionaryKey' could not be found
(are you missing a using directive or an assembly reference?)
and
Error 27 The type or namespace name 'DictionaryKeyAttribute' could not
be found (are you missing a using directive or an assembly reference?)
I then thought I'd add a reference to Castle.Components.DictionaryAdapter.dll, as it could be that CORE didn't have the types listed above implemented in it.
Doing that got rid of all the errors, but gave me a new one:
Error 8 The type 'Castle.Components.DictionaryAdapter.DictionaryAdapterFactory' exists in both 'd:.NET\app\libs\Castle.Core.dll' and 'd:.Net\app\libs\Castle.Components.DictionaryAdapter.dll'
The error happens on the following method implementation:
internal static ISettingService GetServiceFromAdapterFactory(NameValueCollection collection)
{
var adapter = new DictionaryAdapterFactory();
return adapter.GetAdapter<ISettingService>(collection);
}
Has anyone faced such problem when upgrading from 2.1 to 2.5 and could offer me some advice?
Thanks in advance.

To answer my own question here, this is what I had to change in my code.
Changed all the DictionaryKey to become KeyAttribute
Changed all the DictionaryComponent to become ComponentAttribute
Used Kernel.Register instead of Kernel.AddComponent
And obviously removed all the 2.1 DLL's and added the 2.5. You will notice that the DictionaryAdapter.dll has been removed, as it's now bundled within Castle.Core.dll
Hope that helps someone in the future.

Related

RandomNumberGenerator in ASP.NET5

I have created a new Web API project using the ASP.NET 5 Templates. I am wanting to generate random numbers using System.Security.Cryptography.RandomNumberGenerator but it is not available in the .NET Platform 5.4 (see screenshot).
Compiling it also generates the following errors:
Error CS0234 The type or namespace name 'Cryptography' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)
Error CS0246 The type or namespace name 'RandomNumberGenerator' could not be found (are you missing a using directive or an assembly reference?)
Error CS0103 The name 'RandomNumberGenerator' does not exist in the current context
Is there a way to use this or is there an alternative random generator that I can use which is cryptographically secure?
I got it working thanks to Scott Chamberlain's comment by adding the System.Security.Cryptography.Algorithms NuGet package.
I also had to modify the project.json so it was only a dependency of dotnet5.4 and not a global dependency otherwise the compiler would complain that RandomNumberGenerator exists in both System.Security.Cryptography.Algorithms and mscorlib.

Error 1 The type or namespace name 'FPSTimer' could not be found (are you missing a using directive or an assembly reference?)

I am following a code from Intel RealSense 3D camera. However I got this error. If I am supposed to add something to the Reference Assembly can you tell me what that is or how should this be fixed? This pertains to the FaceTracking example in the Intel RealSense 3D SDK Sample Browser.
private FPSTimer m_timer;
and here's the error:
Error 1 The type or namespace name 'FPSTimer' could not be found (are you missing a using directive or an assembly reference?) c:\users\mona\documents\visual studio 2013\Projects\wfa1\wfa1\FaceTracking.cs 10 17 wfa1
I'm thinking you may or may not have the correct references installed, and then you need to add the proper using statement in your code file?
I don;t have this particular SDK on my machine, but there is some documentation available HERE which may be helpful. In particular, maybe THIS section?

Namespace for OData libraries v4 vs v4.5.1

I need to change the .NET framework of an existing solution from 4.5.1 to 4.0.
Several of the projects in the solution reference OData.
I have updated the references (luckilly NuGet is used here) but it seems like the namespaces are different, or I've made a glaring error somewhere.
I get the following errors when I try a build:
The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
This is a typical reference list:
using System.Web.Http.OData.Builder;
using System.Web.Http.OData.Extensions;
No amount of changing references seems to help, so I'd be grateful for any suggestions!
It looks like this is the reason:
http://docs.telerik.com/data-access/developers-guide/using-web-services/asp.net-web-api/developer-guide-wcfservices-web-api-install-nuget-netframework40

The type or namespace name 'DataServiceKeyAttribute' does not exist

The type or namespace name 'DataServiceKeyAttribute' does not exist in
the namespace 'System.Data.Services.Common' (are you missing an
assembly reference?)
This is the error that I have been getting and its driving me crazy. I am trying to build a web portal and I am following this tutorial.
Now after extensive search I am done and out. My target Framework is .Net Framework4 and there are some assemblies, specially the one from CRM sdk with version 5.0.
Could this be an issue?
This Type is defined in the .NET Framework Assembly Microsoft.Data.Services.Client. Ensure that this assembly is referenced by your project and it should work fine.

Unknown namespace during build (but intellisense knows it)

I am currently working on a project with SignalR. On my production server, it is missing an automatically generated js-file in ~/signalr/hubs.
I wanted to try this solution:
SignalR not working on production server
But when I try to add this line to my application_start method in global.asax, my project will not build anymore. Although intellisense knows and suggests the extension method!
I referenced the namespace with using SignalR;. I tried calling it as an extension method and calling it as a static method with the object instance as the first parameter.
The exact error messages:
When calling as extension method:
Error 1 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHubs' and no extension method 'MapHubs' accepting a first argument of type 'System.Web.Routing.RouteCollection' could be found (are you missing a using directive or an assembly reference?)
When calling as static method:
Error 1 The type or namespace name 'RouteExtensions' does not exist in the namespace 'SignalR' (are you missing an assembly reference?)
Anybody knows why this happens and how to solve the problem? Many thanks in advance!
I'm pretty sure that it could be one of these reasons:
Your project requires a reference to an assembly that's not added to the project.
Is your project using the .NET Framework version that's compatible with the referenced assembly?
With your given info, it would be hard to determine the exact reason, but I believe that I provided you some helpful hints.
The fact that intellisense suggests you anything like an extension method won't mean that the project has the required references to work properly.

Categories