“找不到类型或命名空间‘BlobTrigger’" [英] “The type or namespace ‘BlobTrigger’ could not be found”
问题描述
所以我是 C# 中 Azure 函数的新手,我正在尝试使用 BlobStorage 触发器在 Visual Studio 中创建.在遵循模板时,我得到了一个看起来像这样的文件:
So I'm new to Azure functions in C# and I'm trying to create on in Visual Studio with a BlobStorage Trigger. While following the template, I was given a file that looks something like this:
using System;
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host.Triggers;
using Microsoft.Extensions.Logging;
namespace BasicAzureFunction
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([BlobTrigger("samples-workitems/{name}", Connection = "")]Stream myBlob, string name, ILogger log)
{
log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
}
}
}
我总是收到这个错误:
The type or namespace name 'BlobTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?)
我很确定我有所有的包(这就是模板).我错过了什么?
I'm pretty sure I have all the packages (this is literally the template). What am I missing?
使用 .Net 核心
提前致谢!
推荐答案
我有一个同样使用 BlobTrigger 的 Azure 函数,它对我来说工作正常.
I have an Azure Function that also uses a BlobTrigger and it's working correctly for me.
我在您共享的代码中没有看到这个命名空间
I have this namespace that I don't see in the code you shared
使用 Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.Blob;
我的项目中有这些 Nuget 包
and I have these Nuget packages in my project
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
这篇关于“找不到类型或命名空间‘BlobTrigger’"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!