英文:
The type or namespace 'Azure' does not exist in the namespace 'Microsoft' - Visual Studio 2022
问题
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?
英文:
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?
答案1
得分: 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
Or To install packages directly:
Go to Tools > NuGet Package Manager > Manage Nuget Packages for Solution.
我已创建了一个示例的Blob触发Azure函数。
我通过移除环境中安装的包来重现了这个问题,结果是我遇到了相同的错误。
在应用程序中安装了以下包之后,我能够修复错误并获得预期的结果。
输出:
英文:
>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
Or To install packages directly:
Go to Tools > NuGet Package Manager > Manage Nuget Packages for Solution.
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.
After installing the below packages in application, I could fix the error and able to get the expected results.
Output:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论