skip to Main Content

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[...]EventHubSampleSendDataProgram.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

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search