c# - Azure 函数 2.x 中的错误您是否缺少程序集参考?
问题描述
在 c# 中运行 Azure 函数 2.0 时,我在 azure 云门户中遇到错误
The type or namespace name 'Management' does not exist in the namespace 'Microsoft.Azure' (are you missing an assembly reference?)
run.csx 文件是
using System;
using Microsoft.Azure.Management.ContainerInstance.Fluent;
public static void Run(string myEventHubMessage, ILogger log)
{
log.LogInformation($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
}
它的依赖文件是function.proj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance.Fluent" Version="1.16.1" />
</ItemGroup>
</Project>
解决方案
我尝试使用新的函数应用在门户中重新创建您的问题。起初我遇到了同样的错误,我认为是因为包还原失败或一开始没有运行。尝试删除并重新创建您的 function.proj 文件。
推荐阅读
- typescript - 使用 typescript 配置 vscode 启动配置以在云运行模拟器上进行调试
- sql-server-2019 - SQL Server Windows NT - 64 位消耗内存
- python-3.x - 'NoneType' 对象在 python3 中不是可迭代的错误
- r - 下标越界,有界随机游走的迭代
- javascript - 将返回值从一个组件传递到另一个组件
- arrays - 从 Spark Scala 中存在的 Dataframe 创建动态查询
- css - Angular 2 中的动画与纯 CSS
- r - gamlss:算法 RS 尚未收敛
- javascript - NextJS 使用 createElement 渲染链接
- firebase - 仅在部署云功能后出现 GCP 权限错误(在本地工作)