coding99
coding99

Reputation: 68

How can i solve a Dotnet build Error "namespace name 'Azure' could not be found"?

I am running a simple .NET application that connects to Azure Event Hubs and send sample data. Unfortunately when i hit " dotnet run" i get the following errors:

C:\Users\[...]\EventHubSampleSendData\Program.cs(1,7): error CS0246: The type or namespace name 'Azure' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\[...]\SendSampleData.csproj]

It looks like dotnet cannot recognize the Azure library "(using) Azure.Messaging.EventHubs) inside the Program.cs

I tried the command "dotnet add package Azure.Messaging.EventHubs" but it gives also errors ( The project does not support adding package references through the add package command.)

project: https://github.com/Azure-Samples/event-hubs-dotnet-ingest/tree/master/EventHubSampleData/EventHubSampleSendData

Upvotes: 1

Views: 1426

Answers (2)

Kazi Rahiv
Kazi Rahiv

Reputation: 681

restore the dotnet packages, run dotnet restore in your src directory. If that doesn't solve the issue check if the specified package is added otherwise you can add it through nuget.

Upvotes: 1

RithwikBojja
RithwikBojja

Reputation: 11113

The solution is to re-intsall or restore all the packages that you have installed while creating your project. The way to do it is:

enter image description here

enter image description here

Upvotes: 1

Related Questions