Namespace for OData libraries v4 vs v4.5.1 - c#

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

Related

Could not include namespace System.Threading.Tasks

I am unable to include System.Threading.Tasks in my project.
I am Using Asp.net 2013 (4.5)
I am getting the following error -
The type or namespace name 'Tasks' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?)
I had refered earlier questions and they suggested in 4.0+ versions of ASP.NET it will work fine but I coudnt include it in my project.
Help me thanks.
System.Threading.Tasks.Task is in mscorlib which in .NET4.5. My project is not targeting, so in project properties need to change the target to 4.5.

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.

Reference to IQStreamable not found

I am new to StreamInSight development. I have downloaded few samples and now I am trying to compile them. I am getting error as "The type or namespace name 'IQStreamable' could not be found (are you missing a using directive or an assembly reference?)" I have already included below references into my project -
Microsoft.ComplexEventProcessing
System
System.Reactive.Core
System.Reactive.Interfaces
System.Reactive.Linq
System.Reactive.PlatformServices
System.Reactive.Providers
Please let me know if I am missing anything.
You need to make sure that the version of StreamInsight you downloaded and installed is v2.1. The IQStreamable interface is new in v2.1. Once you have confirmed that you have the correct version of StreamInsight or installed the correct version, you'll need to make sure you have the appropriate namespace and assembly included with your project. IQStreamable is in the Microsoft.ComplexEventProcessing.Linq namespace and the Microsoft.ComplexEventProcessing.dll. It also would not hurt to make sure that you are running the most recent version of Rx.

Castle Windsor's DictionaryAdapter

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.

Compiler having trouble with referencing an assembly

I've created a Class Library project called Core. The default namespace is XXX.Tasker.Core.
I've created another Console project which references Core. In my Main() I've got some calls to stuff inside the Core but I'm getting an error:
The type or namespace name 'Core' does
not exist in the namespace
'XXXX.Tasker' (are you missing an
assembly reference?)
The only thing I can think of is that the fact my assembly name is Core might be confusing it.. but that really doesn't make much sense.
Any other suggestions?
The problem turned out to be that Core was compiled as .Net Framework 4 and the Console was .Net Framework 4 Client Profile. Apparently you'll just get really weird errors instead of a proper notification when this occurs.. thanks MS! ;)

Categories