0

I've just installed Visual Studio 2022 and I'm attempting to develop a BlobTrigger Azure function. As part of the default class that is created, the following namespaces are included:

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

However, red lines appear under each of these with the message:

The type or namespace 'Azure' does not exist in the namespace 'Microsoft' 

Any ideas on what I might need to install to get this working?

peterbonar
  • 559
  • 3
  • 6
  • 24
  • run the installer again (you should have a Visual Studio Installer app) and install the azure components – bolov Mar 03 '23 at 15:43
  • The Azure Development option has been selected and is showing as installed in the Visual Studio Installer app. – peterbonar Mar 03 '23 at 15:52
  • Does this answer your question? [The type or namespace name 'Azure' does not exist in the namespace 'Microsoft'](https://stackoverflow.com/questions/47496158/the-type-or-namespace-name-azure-does-not-exist-in-the-namespace-microsoft) – bolov Mar 03 '23 at 16:18
  • @peterbonar Do you have these packages `Microsoft.Azure.WebJobs`, `Microsoft.Azure.WebJobs.Host`, `Microsoft.Extensions.Logging` installed in your visual studio? – Pravallika KV Mar 03 '23 at 16:19

1 Answers1

1

The type or namespace 'Azure' does not exist in the namespace 'Microsoft'.

You should have the packages installed in your visual studio to use them in your application.

  • To install these packages, go to Tools > NuGet Package Manager > Package Manager Console, run the below given commands.
Install-Package Microsoft.Azure.WebJobs
Install-Package Microsoft.Azure.WebJobs.Host
Install-Package Microsoft.Extensions.Logging

enter image description here

Or To install packages directly: Go to Tools > NuGet Package Manager > Manage Nuget Packages for Solution.

enter image description here


I have created a sample Blob Trigger Azure function.

I have reproduced the issue by removing the packages installed in my environment and I was getting the same error.

enter image description here

After installing the below packages in application, I could fix the error and able to get the expected results.

enter image description here

Output:

enter image description here

enter image description here

Pravallika KV
  • 2,415
  • 2
  • 2
  • 7