Object in ProjectReference not accessible when using 'Import'

In a simple project i want to reference objects from a webreference added to another c# library.

The Webreference is called QServices The default namespace is set as below enter image description here

What seems to work is the following code:

Taskworkflow.SI.QServices.Record[] querysResult = new Taskworkflow.SI.QServices.Record[0];

yet when i import the Taskworkflow.SI - namespace, i keep on getting errors:

using TaskWorkflow.SI;
....

QServices.Record[] querysResult = new QServices.Record[0];

This results in the error:

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

Could someone clarify this for me? Thank you for your time.

Note: QServices do only exist inside TaskWorkflow.SI. They do not have any occurences in other projects nor do they have any classes/namespaces/objects that share the name.

Jon Skeet
people
quotationmark

I strongly suspect that for whatever reason, you're ending up with a namespace called QServices declared in the TaskWorkflow.SI namespace. So actually you want:

using TaskWorkflow.SI.QServices;
....

Record[] querysResult = new Record[0];

Or you could explicitly alias it:

using QServices = TaskWorkflow.SI.QServices;
....

QServices.Record[] querysResult = new QServices.Record[0];

people

See more on this question at Stackoverflow