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.)
2
Answers
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:
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.