如何从 Azure Function 添加对 "System.ServiceModel" 的引用?

How to add a reference of "System.ServiceModel" from Azure Function?

我正在从我的 Azure 函数调用 SOAP 服务,为此我需要添加 System.ServiceModel 程序集的引用。我可以使用 Nuget 添加其他依赖项,但由于这个特定的程序集是一个框架程序集,所以我不确定如何在我的 Azure 函数中添加这个程序集的引用。

目前我遇到以下编译错误:

error CS0012: The type 'ClientBase<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

使用 Kudu 将该程序集复制到 bin 文件夹将是我最不想尝试的事情:)

关于更好的方法有什么建议吗?

感谢和问候,

尼尔曼

https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp

您可以通过#r "AssemblyName"指令引用系统程序集

#r "System.Web.Http"

using System.Net;
using System.Net.Http;
using System.Threading.Tasks;

public 静态任务 运行(HttpRequestMessage 请求,TraceWriter 日志)