upgrade ‘Azure.Messaging.EventHubs’ to 5.6.2 return 'EventHubs' does not exist in the namespace 'Microsoft.Azure' error when build

 upgrade

and then build

return

'The type or namespace name 'EventHubs' does not exist in the namespace 'Microsoft.Azure' (are you missing an assembly reference?) [sss-af-filter]'

'The type or namespace name 'EventData' could not be found (are you missing a using directive or an assembly reference?) [sss-af-filter]'

using Microsoft.Azure.EventHubs;

public Microsoft.Azure.EventHubs.EventData Event;


is the high version of 'Azure.Messaging.EventHubs' changed the namespace name or rule?


Yes, the namespace name and some of the class names have changed in the newer version of the Azure.Messaging.EventHubs library compared to the older Microsoft.Azure.EventHubs library. This is because the newer library is a completely rewritten version of the older library.

To fix the error you're seeing, you need to update your using statement to:

csharp
using Azure.Messaging.EventHubs;

And update your EventData class to:

csharp
using Azure.Messaging.EventHubs; public EventData Event;

This should resolve the namespace errors you're encountering.

Comments